I am trying to grab information from a website. I can get it to parse the first record just fine, but how can I have it cycle through all of them?
Code...
<?
$file = fopen("http://cad.chp.ca.gov/sa_list.asp?centerin=LACC&style=l", "r");
$read = fread($file, 300000);
if (ereg("Number of Incidents: ([0-9]{1,2})", $read, $num_accidents)) {
$num_accidents = $num_accidents[1];
}
if (ereg ('<td class="HeadT" colspan="5" align="center">([^<]+)</td>', $read, $location)) {
echo "$location[1]<br><br>";
}
if (ereg ('<tr><td class="T">([^<]+)</td><td class="T" nowrap> ([^<]+)</td><td class="T"><A HREF=./iiqr.asp?([^<]+) TARGET="ii">([^<]+)</td><td class="T">([^<]+)</td><td class="T">([^<]+)</td></tr>', $read, $time)) {
echo "Time : $time[2]<br>";
echo "Type : $time[4]<br>";
echo "Location : $time[5]<br>";
echo "Area : $time[6]<br>";
}
?>
Thanks!