Im trying to scrape the very last table on the right of this page http://anonym.to/?https://vircurex.com/ and grabbing all its data and printing it out. Problem is all these tables user the same styles and class names so Im not sure how to get that specific table.
I have a function I use to get the InnerHtml of any given element:
function InnerHtml($element)
{
$innerHTML = "";
if($element != NULL && $element->hasChildNodes())
{
$children = $element->childNodes;
foreach ($children as $child)
{
$tmp_dom = new DOMDocument();
$tmp_dom->appendChild($tmp_dom->importNode($child, true));
$innerHTML.=trim($tmp_dom->saveHTML());
}
}
return $innerHTML;
}
If you query for the table
$dom_document = new DOMDocument();
@$dom_document->loadHTML("Your Page - However you have decided to download it");
$table = $dom_document->query("table[class='MyList]'");
You should then be able to just pass the last one in the list:
enter code here
echo InnerHtml($table->item(count($table)-1));
I havent tested that but its basically what your after.