I'm trying to extract content within a particular div, that div is called : <div id="info">needthis content</div>
and perhaps another div called: <div class="fap-results" id="person-results">need this content</div>
I'm pulling all the content right now from the page, but that's not what i need... here's what i have:
$html = file_get_contents("http://anyany.yexxxo.com/thispage");
$dom = new DOMDocument;
$items = $dom->getElementsByTagName('div');
for ($i = 0; $i < $items->length; $i++)
echo $items->item($i)->nodeValue . "<br/>";
Thanks in advance.
We do precision guesswork
Since both of those elements have IDs, why not use DOMDocument::getElementById() and save yourself some effort?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)