Here is some of my code ...
$dom = new DomDocument; $html = $newIDs[0]; $dom->validateOnParse = true; $dom->loadHTML($html); $dom->preserveWhiteSpace = true; $tryID = $dom->getElementById('ID'); echo $tryID;
I am trying to get a few specific identifiers from a website, it just shows one, and I saw this method everywhere, including here, but when I try to print something, nothing appears. I tried testing to see that he was reading something using
if(!$tryID) { ("Element not found"); }
But he never prints. Finally, I used
echo $tryID->nodeValue;
and still nothing ... does anyone know what i am doing wrong?
Also, if I get this working, can I read several different things for different variables in the same $ dom? If that makes sense.
source share