2levelsabove Posted February 28, 2010 Share Posted February 28, 2010 OK so I am trying to capture the Root Element at: http://validator.w3.org/check?uri=http%3A%2F%2Fappraisemycar.com&charset=%28detect+automatically%29&doctype=Inline&group=0 which should be a simple "html" I am using the following code and I dont get crap from it: $domDocument = new DOMDocument(); @$domDocument->loadHTML($html);//suppress bad html errors $xPather = new DOMXPath($domDocument); $xPathQuery = "/div[@id='results_container']/form[@id='form']/table/tr[1]/td"; $domNodes = $xPather->query($xPathQuery); foreach($domNodes as $domNode){ $text.= (string)$domNode->textContent; } Why is this not working?????? I know I am passing the right HTML and all. IS my Xpath wrong? Please Link to comment https://forums.phpfreaks.com/topic/193683-simple-xpath-help-gurus/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.