Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/04/2014, 11:12
rufoqe
 
Fecha de Ingreso: mayo-2007
Mensajes: 16
Antigüedad: 17 años
Puntos: 0
Respuesta: reemplazar foreach

Hola, si el codigo completo es el siguiente:

Código PHP:
<?php
include "header.php";
include 
"simple_html_dom.php";

$c getFanpage($fanpage);


libxml_use_internal_errors(true);
$dom = new domDocument;
$dom->loadHTML($c);
$dom->preserveWhiteSpace false;


function 
text($a){
    return (
strip_tags(str_replace("<br>""\n"$a)));
}


function 
photo($a){
    
preg_match("#src=\"(.*?)\"#",$a,$a);
    return 
$a[1];
}

function 
listDivsByClass($class){
    global 
$dom;
    
$xpath = new DomXpath($dom);
    
$div $xpath->query('//*[@class="'.$class.'"]');

    foreach (
$div as $element) {
        
$nodes $element->childNodes;
        foreach (
$nodes as $node) {
          
$a[] = $node->ownerDocument->saveHTML$node );
        }
    }

    return 
$a;
}


$a listDivsByClass('tlAboveUnit');
$b listDivsByClass('tlUnitContent');
$c listDivsByClass('tlBelowUnit');


$posts     = array();
$i         0;
 foreach(
$a as $key => $value) {

    
preg_match("#php\?sid=([0-9]+)#"$c[$i],$id);
    
$id $id[1];

    
$img = (strlen($b[$i])<20?'no':photo($b[$i]));
    
$img preg_replace("#c([0-9]+).([0-9]+).([0-9]+).([0-9]+)#"'',$img);


    
$titleee = ($value==''?':O':text($value));
    
$titleee preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@','',$titleee);


    
$posts[] = array(
                        
'title' => $titleee,
                        
'img'     => $img,
                        
'id'    => $id
                        
);
    
$i++;

    unset(
$img);
    unset(
$id);
    unset(
$titleee);

}



include(
"save.php");
yo decía o me quedaba la duda que si pudiera ser la versión de php por que , yo tengo un hosting de pago en hostgator Cpanel y me sale este error, he probado en varios hosting VPS Webuzo y también sale el mismo error , pero he probado en un hosting gratuito y si funciona , otras personas me han dicho que si funciona en sus hosting pero no quiero estas gastando inutilmente si se puede arreglar,