This is easy, first load the file from the remote server, pattern match it for the correct table,
PHP Code:
$page = file_get_contents($url); $tables = new Array(); preg_match_all('/<table>(.*?)</table>/x',$page,$tables); $mytable = $tables[0][1]; // or the 0 to (n-1)th table on the page $rows = new Array(); $mydata = new Array(); preg_match_all('/<tr>(.*?)</tr>/x',$rows); $r =0; foreach($rows as $row){ $tds = new Array(); preg_match_all('/<td>(.*?)</td>/x',$row[0],$tds); $c = 0; $mydata[$r]= new Array(); foreach($tds as $td){ $mydata[$r][$c++] = $td[1]; } }
So you now have the table's data in the 2d array, $mydata.
Process this and make you page.
|