Reputation: 568
Here's my code:
<?php
$html = file_get_contents("http://aaaaaa.bbbbb.com/thisstuff");
$dom = new DOMDocument;
$dom->loadHTML($html);
var_dump ($dom->getElementsByTagName('div'));
for ($i = 0; $i < $items->length; $i++)
echo $items->item($i)->nodeValue . "<br/>";
?>
The only div class on the page i need to retrieve is:
class="fap index" id="canvas"
How should i got about this, perhaps using document.getElementById?
Any help would be greatly appreciated. Thank you.
Upvotes: 0
Views: 126
Reputation: 71384
Yes, you can use:
$canvas = $dom->getElementById('canvas');
Not sure what you want to do with the DOMElement object that would be set to $canvas
, but you can obviously look at the documentation for DOMElement to see the available methods on it.
http://php.net/manual/en/class.domelement.php
Upvotes: 1