Ich versuche, ein bestimmtes Div-Element (d. H. Mit Attribut id="vung_doc"
) von einer Website zu bekommen, aber ich bekomme fast jedes Element. Hast du eine Ahnung, was los ist?Wie kann ich ein bestimmtes Div von der Website bekommen?
$doc = new DOMDocument;
// We don't want to bother with white spaces
$doc->preserveWhiteSpace = true;
// Most HTML Developers are chimps and produce invalid markup...
$doc->strictErrorChecking = false;
$doc->recover = true;
$doc->loadHTMLFile('http://lightnovelgate.com/chapter/epoch_of_twilight/chapter_300');
$xpath = new DOMXPath($doc);
$query = "//*[@class='vung_doc']";
$entries = $xpath->query($query);
var_dump($entries->item(0)->textContent);
Thank you very much! – sh33pS0ldat