I\'m trying to use the simplehtmldom (http://simplehtmldom.sourceforge.net/) to print out the nth row of a table. Currently nothing happens, is there anything else I need to do?
Assuming row 9 is the row for TUE, you can also do this with PHP's inbuilt DOMDocument, which would save some memory and parsing time and not rely on a 3rd party script.
loadHTML($html);
//TUE 1 1 4.37 6.39 1.08 5.35 9.18 6.00 1.30 6.30 7.42 9.40
echo '
';
foreach($dom->getElementsByTagName('table') as $table) {
echo innerHTML($table->getElementsByTagName('tr')->item(9));
}
echo '
';
function innerHTML($current){
$ret = "";
$nodes = @$current->childNodes;
if(!empty($nodes)){
foreach($nodes as $v){
$tmp = new DOMDocument();
$tmp->appendChild($tmp->importNode($v, true));
$ret .= $tmp->saveHTML();
}
return $ret;
}
return;
}
?>
Your also want to look into caching the result for a day as the site is slooow ;p