Fix for scrape it up

  1.   $xml = simple_get_xml('http://www.cotrip.org/atis/web.TraveltimeMarshal');
  2.   $table = $xml->xpath('/html/body/table[3]');
  3.   foreach ($table[0]->tr as $item) {
  4.     if (count($item) == 1) {
  5.       $direction = trim(strip_tags($item->td));
  6.     }
  7.     else {
  8.       if ($item->td[0] == 'Route Description') {
  9.         // First row - throw this away.
  10.       }
  11.       else {
  12.         $d = $item->td;
  13.         // This is a time line - store the data.
  14.         db_query("INSERT INTO {time_travel} (timestamp, direction, description, ideal_time, estimated_time, speed, generated, length) VALUES (%d, '%s', '%s', %d, %d, %d, '%s', %d)", time(), $direction, $d[0], $d[1], $d[2], $d[3], $d[4]['font'], $d[5]);
  15.       }
  16.     }
  17.   }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.