private static function fetchData($station, $time, $lang, $timeSel) { include "../includes/getUA.php"; $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent); $body = ""; //we want data for 1 hour. But we can only retrieve 15 minutes per request for ($i = 0; $i < 4; $i++) { $scrapeUrl = "http://www.railtime.be/mobile/SearchStation.aspx"; $scrapeUrl .= "?l=EN&tr=" . $time . "-15&s=1&sid=" . stations::getRTID($station, $lang) . "&da=" . $timeSel . "&p=2"; $post = http_post_data($scrapeUrl, "", $request_options) or die(""); $body .= http_parse_message($post)->body; $time = tools::addQuarter($time); } return $body; }
private static function fetchData($station, $time, $lang, $timeSel) { include "../includes/getUA.php"; $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent); $body = ""; //we want data for 1 hour. But we can only retrieve 15 minutes per request for ($i = 0; $i < 4; $i++) { $scrapeUrl = "http://www.railtime.be/mobile/HTML/StationDetail.aspx"; $rt = stations::getRTID($station, $lang); $rtname = $rt->rtname; $rtid = $rt->rtid; $scrapeUrl .= "?sn=" . urlencode($rtname) . "&sid=" . urlencode($rtid) . "&ti=" . urlencode($time) . "&da=" . urlencode($timeSel) . "&l=EN&s=1"; $post = http_post_data($scrapeUrl, "", $request_options) or die(""); $body .= http_parse_message($post)->body; $time = tools::addQuarter($time); } return $body; }