I am trying to scrap some content from a website but the code below is not working(not showing any output). here is the code
$url=\"some url\";
$otherHeader
This question reminds me that a lot of times the solution to a problem lies in simplicity and not complications. i was trying namespaces,error corrections,etc but the solution just demanded close inspection of the code.
the problem with my code was the order of loadHTML() and xpath initialization. initially the order was
$xpath=new DOMXPath($page);
$page->loadHTML($content);
by doing this i was actually initializing xapth on an empty document. now reversing the order by first loading the dom with the html and then initializing the xpath i was able to get the desired results. Also as suggested that by removing the tbodyelement from xpath as firefox automatically inserts it. so the correct xpath should be
$path1="//body/table[4]/tr[3]/td[4]";
$path2="//body/table[4]/tr[1]/td[4]";
thanks to everyone for their suggestions and bearing this.