Código PHP:
$html = file_get_contents('http://www.url.com/');
$htmlDoc = new DomDocument();
$htmlDoc->formatOutput = true;
$res = @$htmlDoc->loadHTML($html);
$div = $htmlDoc->getElementsByTagName("div");
foreach ($div as $nombres) {
$clas=$nombres->getAttribute("class");
if($clas== "classicCompact"){
echo $clas=$nombres->getAttribute("class");
$form=$clas->getElementsByTagName("form");
foreach($form as $for){
echo $for->getAttributes("id");
}
}
}
El error que me da es este
Código:
Alguien me podria decir cual es la forma correcta para aceder dentro de tantas etiquetas??Perro Fatal error: Call to a member function getElementsByTagName() on a non-object in C:\AppServ\www\juegos\shop4.php on line 16
Desde ya muchas gracias.