This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This class is part of FlightAirmap. It's used to retrieve schedules |
||
4 | * |
||
5 | * Copyright (c) Ycarus (Yannick Chabanois) at Zugaina <[email protected]> |
||
6 | * Licensed under AGPL license. |
||
7 | * For more information see: https://www.flightairmap.com/ |
||
8 | */ |
||
9 | require_once(dirname(__FILE__).'/libs/simple_html_dom.php'); |
||
10 | require_once(dirname(__FILE__).'/settings.php'); |
||
11 | require_once(dirname(__FILE__).'/class.Connection.php'); |
||
12 | require_once(dirname(__FILE__).'/class.Translation.php'); |
||
13 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
||
14 | require_once(dirname(__FILE__).'/class.Common.php'); |
||
15 | require_once(dirname(__FILE__).'/libs/uagent/uagent.php'); |
||
16 | |||
17 | class Schedule { |
||
18 | protected $cookies = array(); |
||
19 | public $db; |
||
20 | |||
21 | /* |
||
22 | * Initialize connection to DB |
||
23 | */ |
||
24 | public function __construct($dbc = null) { |
||
25 | $Connection = new Connection($dbc); |
||
26 | $this->db = $Connection->db(); |
||
27 | if ($this->db === null) die('Error: No DB connection.'); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Add schedule data to database |
||
32 | * @param String $ident aircraft ident |
||
33 | * @param String $departure_airport_icao departure airport icao |
||
34 | * @param String $departure_airport_time departure airport time |
||
35 | * @param String $arrival_airport_icao arrival airport icao |
||
36 | * @param String $arrival_airport_time arrival airport time |
||
37 | * @param String $source source of data |
||
38 | * @return string |
||
39 | */ |
||
40 | public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
||
41 | date_default_timezone_set('UTC'); |
||
42 | $date = date("Y-m-d H:i:s",time()); |
||
43 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
||
44 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
||
45 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
||
46 | $query_values = array(':ident' => $ident); |
||
47 | try { |
||
48 | $sth = $this->db->prepare($query); |
||
49 | $sth->execute($query_values); |
||
50 | } catch(PDOException $e) { |
||
51 | return "error : ".$e->getMessage(); |
||
52 | } |
||
53 | if ($sth->fetchColumn() > 0) { |
||
54 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
||
55 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
||
56 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
||
57 | } elseif ($arrival_airport_time == '') { |
||
58 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
||
59 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
||
60 | } elseif ($departure_airport_time == '') { |
||
61 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
||
62 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
||
63 | } else { |
||
64 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
||
65 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
||
66 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
||
67 | } |
||
68 | try { |
||
69 | $sth = $this->db->prepare($query); |
||
70 | $sth->execute($query_values); |
||
71 | } catch(PDOException $e) { |
||
72 | return "error : ".$e->getMessage(); |
||
73 | } |
||
74 | if ($sth->fetchColumn() == 0) { |
||
75 | //$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident'; |
||
76 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
||
77 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
||
78 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
||
79 | } elseif ($arrival_airport_time == '') { |
||
80 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
||
81 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
||
82 | } elseif ($departure_airport_time == '') { |
||
83 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
||
84 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
||
85 | } else { |
||
86 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
||
87 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
||
88 | } |
||
89 | try { |
||
90 | $sth = $this->db->prepare($query); |
||
91 | $sth->execute($query_values); |
||
92 | } catch(PDOException $e) { |
||
93 | return "error : ".$e->getMessage(); |
||
94 | } |
||
95 | } else { |
||
96 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
||
97 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
||
98 | $query_values = array(':ident' => $ident,':date' => $date); |
||
99 | try { |
||
100 | $sth = $this->db->prepare($query); |
||
101 | $sth->execute($query_values); |
||
102 | } catch(PDOException $e) { |
||
103 | return "error : ".$e->getMessage(); |
||
104 | } |
||
105 | } |
||
106 | } else { |
||
107 | $query = 'INSERT INTO routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source) VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)'; |
||
108 | $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
||
109 | try { |
||
110 | $sth = $this->db->prepare($query); |
||
111 | $sth->execute($query_values); |
||
112 | } catch(PDOException $e) { |
||
113 | return "error : ".$e->getMessage(); |
||
114 | } |
||
115 | } |
||
116 | return ''; |
||
117 | } |
||
118 | |||
119 | /* |
||
120 | * Get schedule data by ident |
||
121 | * @param String $ident Flight ident |
||
122 | * @return Array Schedules info |
||
123 | */ |
||
124 | public function getSchedule($ident) { |
||
125 | $Translation = new Translation($this->db); |
||
126 | $operator = $Translation->checkTranslation($ident,false); |
||
127 | if ($ident != $operator) { |
||
128 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1"; |
||
129 | $query_values = array(':ident' => $ident,'operator' => $operator); |
||
130 | } else { |
||
131 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1"; |
||
132 | $query_values = array(':ident' => $ident); |
||
133 | } |
||
134 | try { |
||
135 | $sth = $this->db->prepare($query); |
||
136 | $sth->execute($query_values); |
||
137 | } catch(PDOException $e) { |
||
138 | return "error : ".$e->getMessage(); |
||
139 | } |
||
140 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
||
141 | $sth->closeCursor(); |
||
142 | if (is_array($row) && count($row) > 0) { |
||
143 | return $row; |
||
144 | } else return array(); |
||
145 | } |
||
146 | |||
147 | /* |
||
148 | * Check if there is schedule info for an ident |
||
149 | * @param String $ident Flight ident |
||
150 | * @return Integer 1 if result, 0 if no results |
||
151 | */ |
||
152 | public function checkSchedule($ident) { |
||
153 | global $globalDBdriver; |
||
154 | //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1"; |
||
155 | if ($globalDBdriver == 'mysql') { |
||
156 | $query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1"; |
||
157 | } else { |
||
158 | $query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident |
||
159 | AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL) |
||
160 | OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1"; |
||
161 | } |
||
162 | $query_values = array(':ident' => $ident); |
||
163 | try { |
||
164 | $sth = $this->db->prepare($query); |
||
165 | $sth->execute($query_values); |
||
166 | } catch(PDOException $e) { |
||
167 | return "error : ".$e->getMessage(); |
||
168 | } |
||
169 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
||
170 | $sth->closeCursor(); |
||
171 | return $row['nb']; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * Get flight info from Air France |
||
176 | * @param String $callsign The callsign |
||
177 | * @param String $date date we want flight number info |
||
178 | * @param String $carrier IATA code |
||
179 | * @return array departure and arrival airports and time |
||
180 | */ |
||
181 | public function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
||
182 | $Common = new Common(); |
||
183 | $check_date = new Datetime($date); |
||
184 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
185 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
186 | $url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym'); |
||
187 | $json = $Common->getData($url); |
||
188 | var_dump($json); |
||
0 ignored issues
–
show
Security
Debugging Code
introduced
by
![]() |
|||
189 | $parsed_json = json_decode($json); |
||
190 | if (property_exists($parsed_json,'errors') === false) { |
||
191 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
||
192 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
||
193 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
||
194 | $departureTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureTime'}; |
||
195 | //$destinationLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'destinationLong'}; |
||
196 | $destinationShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'destinationShort'}; |
||
197 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
||
198 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
||
199 | |||
200 | preg_match('/\((.*?)\)/',$originShort,$originiata); |
||
201 | $DepartureAirportIata = $originiata[1]; |
||
202 | preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
||
203 | $ArrivalAirportIata = $destinationiata[1]; |
||
204 | |||
205 | /* |
||
206 | date_default_timezone_set('Europe/Paris'); |
||
207 | $departureTime = gmdate('H:i',strtotime($departureTime)); |
||
208 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
||
209 | */ |
||
210 | |||
211 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
||
212 | } else return array(); |
||
213 | } |
||
214 | |||
215 | /** |
||
216 | * Get flight info from EasyJet |
||
217 | * @param String $callsign The callsign |
||
218 | * @param String $date date we want flight number info |
||
219 | * @return array departure and arrival airports and time |
||
220 | */ |
||
221 | private function getEasyJet($callsign, $date = 'NOW') { |
||
222 | global $globalTimezone; |
||
223 | $Common = new Common(); |
||
224 | date_default_timezone_set($globalTimezone); |
||
225 | $check_date = new Datetime($date); |
||
226 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
227 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
228 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
||
229 | $json = $Common->getData($url); |
||
230 | $parsed_json = json_decode($json); |
||
231 | |||
232 | $flights = $parsed_json->{'flights'}; |
||
233 | if (count($flights) > 0) { |
||
234 | $DepartureAirportIata = $parsed_json->{'flights'}[0]->{'airports'}->{'pda'}->{'iata'}; //name |
||
235 | $ArrivalAirportIata = $parsed_json->{'flights'}[0]->{'airports'}->{'paa'}->{'iata'}; //name |
||
236 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
||
237 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
||
238 | |||
239 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
||
240 | } else return array(); |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * Get flight info from Ryanair |
||
245 | * @param String $callsign The callsign |
||
246 | * @return array Flight departure and arrival airports and time |
||
247 | */ |
||
248 | private function getRyanair($callsign) { |
||
249 | $Common = new Common(); |
||
250 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
251 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
252 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
||
253 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
||
254 | $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
||
255 | $json = $Common->getData($url,'post',$post,$headers); |
||
256 | $parsed_json = json_decode($json); |
||
257 | if (isset($parsed_json->{'flightInfo'})) { |
||
258 | $flights = $parsed_json->{'flightInfo'}; |
||
259 | if (count($flights) > 0) { |
||
260 | $DepartureAirportIata = $parsed_json->{'flightInfo'}[0]->{'departureAirport'}->{'iata'}; //name |
||
261 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
||
262 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
||
263 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
||
264 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
||
265 | } else return array(); |
||
266 | } else return array(); |
||
267 | } |
||
268 | |||
269 | /** |
||
270 | * Get flight info from Swiss |
||
271 | * @param string $callsign The callsign |
||
272 | * @return array Flight departure and arrival airports and time |
||
273 | */ |
||
274 | private function getSwiss($callsign) { |
||
275 | $Common = new Common(); |
||
276 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
277 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
278 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
||
279 | $json = $Common->getData($url); |
||
280 | $parsed_json = json_decode($json); |
||
281 | |||
282 | |||
283 | $flights = $parsed_json->{'flights'}; |
||
284 | if (count($flights) > 0) { |
||
285 | $departureTime = ''; |
||
286 | $arrivalTime = ''; |
||
287 | foreach ($flights as $flight) { |
||
288 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
||
289 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
||
290 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
||
291 | $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
||
292 | $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
||
293 | } |
||
294 | } |
||
295 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
||
296 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
||
297 | } else return array(); |
||
298 | } else return array(); |
||
299 | } |
||
300 | |||
301 | /** |
||
302 | * Get flight info from British Airways API |
||
303 | * @param String $callsign The callsign |
||
304 | * @param String $date date we want flight number info |
||
305 | * @return array Flight departure and arrival airports and time |
||
306 | */ |
||
307 | public function getBritishAirways($callsign, $date = 'NOW') { |
||
308 | global $globalBritishAirwaysKey; |
||
309 | $Common = new Common(); |
||
310 | $check_date = new Datetime($date); |
||
311 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
||
312 | if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
||
313 | if ($globalBritishAirwaysKey == '') return array(); |
||
314 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
||
315 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
||
316 | $json = $Common->getData($url,'get','',$headers); |
||
317 | if ($json == '') return array(); |
||
318 | $parsed_json = json_decode($json); |
||
319 | $flights = $parsed_json->{'FlightsResponse'}; |
||
320 | if (count($flights) > 0) { |
||
321 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
||
322 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
||
323 | $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
||
324 | $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
||
325 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
||
326 | } else return array(); |
||
327 | } |
||
328 | |||
329 | /** |
||
330 | * Get flight info from Lutfhansa API |
||
331 | * @param String $callsign The callsign |
||
332 | * @param String $date date we want flight number info |
||
333 | * @return array Flight departure and arrival airports and time |
||
334 | */ |
||
335 | public function getLufthansa($callsign, $date = 'NOW') { |
||
336 | global $globalLufthansaKey; |
||
337 | $Common = new Common(); |
||
338 | $check_date = new Datetime($date); |
||
339 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
||
340 | if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
||
341 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
||
342 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
||
343 | $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
||
344 | $data = $Common->getData($url,'post',$post); |
||
345 | $parsed_data = json_decode($data); |
||
346 | if (!isset($parsed_data->{'access_token'})) return array(); |
||
347 | $token = $parsed_data->{'access_token'}; |
||
348 | |||
349 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
||
350 | $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
||
351 | $json = $Common->getData($url,'get','',$headers); |
||
352 | if ($json == '') return array(); |
||
353 | $parsed_json = json_decode($json); |
||
354 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
||
355 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
||
356 | $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
||
357 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
||
358 | $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
||
359 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
||
360 | } else return array(); |
||
361 | } |
||
362 | |||
363 | /** |
||
364 | * Get flight info from Transavia API |
||
365 | * @param string $callsign The callsign |
||
366 | * @param string $date date we want flight number info |
||
367 | * @return array Flight departure and arrival airports and time |
||
368 | */ |
||
369 | public function getTransavia($callsign, $date = 'NOW') { |
||
370 | global $globalTransaviaKey; |
||
371 | $Common = new Common(); |
||
372 | $check_date = new Datetime($date); |
||
373 | $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
||
374 | if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
||
375 | if ($globalTransaviaKey == '') return array(); |
||
376 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
||
377 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
||
378 | $headers = array('apikey: '.$globalTransaviaKey); |
||
379 | $json = $Common->getData($url,'get','',$headers); |
||
380 | //echo 'result : '.$json; |
||
381 | if ($json == '') return array(); |
||
382 | $parsed_json = json_decode($json); |
||
383 | |||
384 | if (isset($parsed_json->{'data'}[0])) { |
||
385 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
||
386 | $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
||
387 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
||
388 | $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
||
389 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
||
390 | } else return array(); |
||
391 | } |
||
392 | |||
393 | /** |
||
394 | * Get flight info from Tunisair |
||
395 | * @param string $callsign The callsign |
||
396 | * @return array Flight departure and arrival airports and time |
||
397 | */ |
||
398 | public function getTunisair($callsign) { |
||
399 | $Common = new Common(); |
||
400 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
401 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
402 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
||
403 | $data = $Common->getData($url); |
||
404 | $table = $Common->table2array($data); |
||
405 | foreach ($table as $flight) { |
||
406 | if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
||
407 | return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
||
408 | } |
||
409 | } |
||
410 | return array(); |
||
411 | } |
||
412 | |||
413 | /** |
||
414 | * Get flight info from Vueling |
||
415 | * @param String $callsign The callsign |
||
416 | * @param string $date |
||
417 | * @return array Flight departure and arrival airports and time |
||
418 | */ |
||
419 | public function getVueling($callsign,$date = 'NOW') { |
||
420 | $Common = new Common(); |
||
421 | $check_date = new Datetime($date); |
||
422 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
423 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
424 | $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
||
425 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
||
426 | $data = $Common->getData($url); |
||
427 | $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
||
428 | if ($data != '') { |
||
429 | preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
||
430 | $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
||
431 | preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
||
432 | $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
||
433 | if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
||
434 | else return array(); |
||
435 | } |
||
436 | return array(); |
||
437 | } |
||
438 | |||
439 | /** |
||
440 | * Get flight info from Iberia |
||
441 | * @param String $callsign The callsign |
||
442 | * @param String $date date we want flight number info |
||
443 | * @return array Flight departure and arrival airports and time |
||
444 | */ |
||
445 | public function getIberia($callsign, $date = 'NOW') { |
||
446 | $Common = new Common(); |
||
447 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
448 | $check_date = new Datetime($date); |
||
449 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
450 | $url = "https://www.iberia.com/web/flightDetail.do"; |
||
451 | $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
||
452 | $data = $Common->getData($url,'post',$post); |
||
453 | if ($data != '') { |
||
454 | $table = $Common->table2array($data); |
||
455 | //print_r($table); |
||
456 | if (count($table) > 0) { |
||
457 | $flight = $table; |
||
458 | preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
||
459 | preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
||
460 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
||
461 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
||
462 | $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
||
463 | $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
||
464 | if ($arrivalTime == 'Hora estimada de llegada') { |
||
465 | $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
||
466 | } else $arrivalTime = substr($arrivalTime,0,5); |
||
467 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
||
468 | } |
||
469 | } |
||
470 | return array(); |
||
471 | } |
||
472 | |||
473 | /** |
||
474 | * Get flight info from Star Alliance |
||
475 | * @param String $callsign The callsign |
||
476 | * @param String $date date we want flight number info |
||
477 | * @param string $carrier |
||
478 | * @return array Flight departure and arrival airports and time |
||
479 | */ |
||
480 | |||
481 | private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
||
482 | $Common = new Common(); |
||
483 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
484 | $check_date = new Datetime($date); |
||
485 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
486 | $url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y'); |
||
487 | $data = $Common->getData($url); |
||
488 | if ($data != '') { |
||
489 | $table = $Common->table2array($data); |
||
490 | if (count($table) > 0) { |
||
491 | $flight = $table; |
||
492 | //print_r($table); |
||
493 | if (isset($flight[25]) && isset($flight[29])) { |
||
494 | preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
||
495 | preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
||
496 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
||
497 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
||
498 | $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
||
499 | $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
||
500 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
||
501 | } else return array(); |
||
502 | } |
||
503 | |||
504 | |||
505 | } |
||
506 | return array(); |
||
507 | } |
||
508 | |||
509 | |||
510 | /** |
||
511 | * Get flight info from Alitalia |
||
512 | * @param String $callsign The callsign |
||
513 | * @param String $date date we want flight number info |
||
514 | * @return array Flight departure and arrival airports and time |
||
515 | */ |
||
516 | private function getAlitalia($callsign, $date = 'NOW') { |
||
517 | $Common = new Common(); |
||
518 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
519 | $check_date = new Datetime($date); |
||
520 | $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
||
521 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
522 | $data = $Common->getData($url); |
||
523 | if ($data != '') { |
||
524 | $table = $Common->text2array($data); |
||
525 | $DepartureAirportIata = ''; |
||
526 | $ArrivalAirportIata = ''; |
||
527 | $departureTime = $table[4]; |
||
528 | $arrivalTime = $table[5]; |
||
529 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
||
530 | } |
||
531 | return array(); |
||
532 | } |
||
533 | |||
534 | /** |
||
535 | * Get flight info from Brussels airlines |
||
536 | * @param String $callsign The callsign |
||
537 | * @param String $date date we want flight number info |
||
538 | * @return array Flight departure and arrival airports and time |
||
539 | */ |
||
540 | private function getBrussels($callsign, $date = 'NOW') { |
||
541 | $Common = new Common(); |
||
542 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
543 | $check_date = new Datetime($date); |
||
544 | $url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
||
545 | //http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber"; |
||
546 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
547 | $data = $Common->getData($url); |
||
548 | if ($data != '') { |
||
549 | //echo $data; |
||
550 | $parsed_json = json_decode($data,true); |
||
551 | if (isset($parsed_json[0]['FromAirportCode'])) { |
||
552 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
||
553 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
||
554 | $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
||
555 | $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
||
556 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
||
557 | } |
||
558 | } |
||
559 | return array(); |
||
560 | } |
||
561 | |||
562 | /** |
||
563 | * Get flight info from FlightRadar24 |
||
564 | * @param String $callsign The callsign |
||
565 | * @param String $date date we want flight number info |
||
566 | * @return array Flight departure and arrival airports and time |
||
567 | */ |
||
568 | /* |
||
569 | public function getFlightRadar24($callsign, $date = 'NOW') { |
||
570 | $Common = new Common(); |
||
571 | $url= "http://arn.data.fr24.com/zones/fcgi/feed.js?flight=".$callsign; |
||
572 | $data = $Common->getData($url); |
||
573 | if ($data != '') { |
||
574 | $parsed_json = get_object_vars(json_decode($data)); |
||
575 | if (count($parsed_json) > 2) { |
||
576 | $info = array_splice($parsed_json,2,1); |
||
577 | $fr24id = current(array_keys($info)); |
||
578 | $urldata = "http://krk.data.fr24.com/_external/planedata_json.1.4.php?f=".$fr24id; |
||
579 | $datapl = $Common->getData($urldata); |
||
580 | if ($datapl != '') { |
||
581 | $parsed_jsonpl = json_decode($datapl); |
||
582 | if (isset($parsed_jsonpl->from_iata)) { |
||
583 | $DepartureAirportIata = $parsed_jsonpl->from_iata; |
||
584 | $ArrivalAirportIata = $parsed_jsonpl->to_iata; |
||
585 | $departureTime = date('H:i',$parsed_jsonpl->dep_schd); |
||
586 | $arrivalTime = date('H:i',$parsed_jsonpl->arr_schd); |
||
587 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightradar24'); |
||
588 | } |
||
589 | } |
||
590 | } |
||
591 | } |
||
592 | return array(); |
||
593 | } |
||
594 | */ |
||
595 | /** |
||
596 | * Get flight info from Lufthansa |
||
597 | * @param String $callsign The callsign |
||
598 | * @param String $date date we want flight number info |
||
599 | * @return array Flight departure and arrival airports and time |
||
600 | */ |
||
601 | |||
602 | /* private function getLufthansa($callsign, $date = 'NOW') { |
||
603 | $Common = new Common(); |
||
604 | */ |
||
605 | //$numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
606 | /* |
||
607 | $url= "http://www.lufthansa.com/fr/fr/Arrivees-Departs-fonction"; |
||
608 | $check_date = new Datetime($date); |
||
609 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
610 | |||
611 | $post = array('flightNumber' => $numvol, 'date' => $check_date->format('Y-m-d'),'time' => '12:00','timezoneOffset' => '0','selection' => '0','arrivalDeparture' => 'D'); |
||
612 | $data = $Common->getData($url,'post',$post); |
||
613 | if ($data != '') { |
||
614 | $table = $Common->table2array($data); |
||
615 | $departureTime = trim(str_replace($check_date->format('d.m.Y'),'',$table[25][3])); |
||
616 | } |
||
617 | |||
618 | $post = array('flightNumber' => $numvol, 'date' => $check_date->format('Y-m-d'),'time' => '12:00','timezoneOffset' => '0','selection' => '0','arrivalDeparture' => 'A'); |
||
619 | $data = $Common->getData($url,'post',$post); |
||
620 | if ($data != '') { |
||
621 | $table = $Common->table2array($data); |
||
622 | $arrivalTime = trim(str_replace($check_date->format('d.m.Y'),'',$table[25][3])); |
||
623 | } |
||
624 | return array('DepartureAirportIATA' => '','DepartureTime' => $departureTime,'ArrivalAirportIATA' => '','ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
||
625 | } |
||
626 | */ |
||
627 | /** |
||
628 | * Get flight info from flytap |
||
629 | * @param String $callsign The callsign |
||
630 | * @return array Flight departure and arrival airports and time |
||
631 | */ |
||
632 | private function getFlyTap($callsign) { |
||
633 | $Common = new Common(); |
||
634 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
635 | $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
||
636 | //$check_date = new Datetime($date); |
||
637 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
638 | $post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1'); |
||
639 | $data = $Common->getData($url,'post',$post); |
||
640 | if ($data != '') { |
||
641 | $table = $Common->table2array($data); |
||
642 | $departureTime = trim(substr($table[15][0],0,5)); |
||
643 | $arrivalTime = trim(substr($table[35][0],0,5)); |
||
644 | preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
||
645 | preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
||
646 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
||
647 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
||
648 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
||
649 | } |
||
650 | return array(); |
||
651 | } |
||
652 | |||
653 | /** |
||
654 | * Get flight info from flightmapper |
||
655 | * @param String $callsign The callsign |
||
656 | * @return array Flight departure and arrival airports and time |
||
657 | */ |
||
658 | public function getFlightMapper($callsign) { |
||
659 | $Common = new Common(); |
||
660 | $airline_icao = ''; |
||
661 | if (!is_numeric(substr($callsign, 0, 3))) |
||
662 | { |
||
663 | if (is_numeric(substr(substr($callsign, 0, 3), -1, 1))) { |
||
664 | $airline_icao = substr($callsign, 0, 2); |
||
665 | } elseif (is_numeric(substr(substr($callsign, 0, 4), -1, 1))) { |
||
666 | $airline_icao = substr($callsign, 0, 3); |
||
667 | } |
||
668 | } |
||
669 | if ($airline_icao == '') return array(); |
||
670 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
671 | $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
||
672 | //$check_date = new Datetime($date); |
||
673 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
674 | $data = $Common->getData($url); |
||
675 | if ($data != '') { |
||
676 | $table = $Common->table2array($data); |
||
677 | if (isset($table[5][0])) { |
||
678 | $sched = $table[5][0]; |
||
679 | $dhour = ''; |
||
680 | $darr = ''; |
||
681 | $ahour = ''; |
||
682 | $aarr = ''; |
||
683 | $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
||
684 | if ($n == 7) { |
||
685 | $departureTime = $dhour; |
||
686 | $arrivalTime = $ahour; |
||
687 | $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
||
688 | $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
||
689 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
||
690 | } |
||
691 | } |
||
692 | } |
||
693 | return array(); |
||
694 | } |
||
695 | |||
696 | /** |
||
697 | * Get flight info from flightaware |
||
698 | * @param String $callsign The callsign |
||
699 | * @return array Flight departure and arrival airports and time |
||
700 | */ |
||
701 | public function getFlightAware($callsign) { |
||
702 | global $globalFlightAwareUsername, $globalFlightAwarePassword; |
||
703 | date_default_timezone_set('UTC'); |
||
704 | $Common = new Common(); |
||
705 | /* |
||
706 | if (!is_numeric(substr($callsign, 0, 3))) |
||
707 | { |
||
708 | if (is_numeric(substr(substr($callsign, 0, 3), -1, 1))) { |
||
709 | $airline_icao = substr($callsign, 0, 2); |
||
710 | } elseif (is_numeric(substr(substr($callsign, 0, 4), -1, 1))) { |
||
711 | $airline_icao = substr($callsign, 0, 3); |
||
712 | } |
||
713 | } |
||
714 | */ |
||
715 | //$numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
716 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
717 | if ($globalFlightAwareUsername != '' && $globalFlightAwarePassword != '') { |
||
718 | $url = 'http://'.$globalFlightAwareUsername.':'.$globalFlightAwarePassword.'@flightxml.flightaware.com/json/FlightXML3/FlightInfoStatus?ident='.$callsign; |
||
719 | $data = $Common->getData($url); |
||
720 | if ($data != '') { |
||
721 | $result = json_decode($data,true); |
||
722 | $flight = $result['FlightInfoStatusResult']['flights'][0]; |
||
723 | if (isset($flight['origin'])) { |
||
724 | return array( |
||
725 | 'DepartureAirportIATA' => $flight['origin']['alternate_ident'], |
||
726 | 'DepartureTime' => $flight['filed_departure_time']['time'], |
||
727 | 'ArrivalAirportIATA' => $flight['destination']['alternate_ident'], |
||
728 | 'ArrivalTime' => $flight['filed_arrival_time']['time'], |
||
729 | 'Source' => 'website_flightaware'); |
||
730 | } |
||
731 | } |
||
732 | } |
||
733 | |||
734 | $url= "http://flightaware.com/live/flight/".$callsign; |
||
735 | $data = $Common->getData($url); |
||
736 | if ($data != '') { |
||
737 | preg_match(':<script>var trackpollBootstrap = (.*?);</script>:',$data,$result); |
||
738 | $flights = json_decode($result[1],true); |
||
739 | $flight = reset($flights['flights']); |
||
740 | if (isset($flight['activityLog']['flights'][0]['origin'])) { |
||
741 | return array( |
||
742 | 'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'], |
||
743 | 'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
||
744 | 'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'], |
||
745 | 'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
||
746 | 'Source' => 'website_flightaware'); |
||
747 | } |
||
748 | } |
||
749 | return array(); |
||
750 | } |
||
751 | |||
752 | /** |
||
753 | * Get flight info from CostToTravel |
||
754 | * @param String $callsign The callsign |
||
755 | * @return array Flight departure and arrival airports and time |
||
756 | */ |
||
757 | public function getCostToTravel($callsign) { |
||
758 | $Common = new Common(); |
||
759 | $url= "http://www.costtotravel.com/flight-number/".$callsign; |
||
760 | //$check_date = new Datetime($date); |
||
761 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
762 | $data = $Common->getData($url); |
||
763 | if ($data != '') { |
||
764 | $table = $Common->table2array($data); |
||
765 | if (isset($table[11][1])) { |
||
766 | if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5); |
||
767 | else $departureTime = ''; |
||
768 | if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5); |
||
769 | else $arrivalTime = ''; |
||
770 | $DepartureAirportIata = substr($table[13][1],0,3); |
||
771 | $ArrivalAirportIata = substr($table[15][1],0,3); |
||
772 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
||
773 | } |
||
774 | } |
||
775 | return array(); |
||
776 | } |
||
777 | |||
778 | /** |
||
779 | * Get flight info from Air Canada |
||
780 | * @param string $callsign The callsign |
||
781 | * @param string $date date we want flight number info |
||
782 | * @return array Flight departure and arrival airports and time |
||
783 | */ |
||
784 | private function getAirCanada($callsign,$date = 'NOW') { |
||
785 | $Common = new Common(); |
||
786 | if (class_exists("DomDocument") === FALSE) return array(); |
||
787 | date_default_timezone_set('UTC'); |
||
788 | $check_date = new Datetime($date); |
||
789 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
790 | $url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
||
791 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
792 | $data = $Common->getData($url); |
||
793 | $dom = new DomDocument(); |
||
794 | $dom->loadXML($data); |
||
795 | if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) return array(); |
||
796 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
||
797 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
||
798 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
||
799 | $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
||
800 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
||
801 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
||
802 | $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
||
803 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
||
804 | } else return array(); |
||
805 | } |
||
806 | |||
807 | /** |
||
808 | * Get flight info from Vietnam Airlines |
||
809 | * @param String $callsign The callsign |
||
810 | * @param String $date date we want flight number info |
||
811 | * @return array Flight departure and arrival airports and time |
||
812 | */ |
||
813 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
||
814 | $Common = new Common(); |
||
815 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
816 | $check_date = new Datetime($date); |
||
817 | $url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
||
818 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
819 | $data = $Common->getData($url); |
||
820 | if ($data != '') { |
||
821 | $table = $Common->table2array($data); |
||
822 | $flight = $table; |
||
823 | preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
||
824 | preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
||
825 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
||
826 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
||
827 | $departureTime = $flight[5][1]; |
||
828 | $arrivalTime = $flight[23][1]; |
||
829 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
||
830 | } |
||
831 | return array(); |
||
832 | } |
||
833 | |||
834 | /** |
||
835 | * Get flight info from Air Berlin |
||
836 | * @param String $callsign The callsign |
||
837 | * @param String $date date we want flight number info |
||
838 | * @param String $carrier airline code |
||
839 | * @return array Flight departure and arrival airports and time |
||
840 | */ |
||
841 | private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
||
842 | $Common = new Common(); |
||
843 | date_default_timezone_set('UTC'); |
||
844 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
||
845 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
||
846 | $check_date = new Datetime($date); |
||
847 | $url= "http://www.airberlin.com/en-US/site/aims.php"; |
||
848 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
||
849 | $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
||
850 | $data = $Common->getData($url,'post',$post); |
||
851 | //echo $data; |
||
852 | $DepartureAirportIata = ''; |
||
853 | $ArrivalAirportIata = ''; |
||
854 | |||
855 | if ($data != '') { |
||
856 | $table = $Common->table2array($data); |
||
857 | $flight = $table; |
||
858 | if (isset($flight[5][4])) $departureTime = $flight[5][4]; |
||
859 | else $departureTime = ''; |
||
860 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
||
861 | else $departureAirport = ''; |
||
862 | } else return array(); |
||
863 | $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
||
864 | $data = $Common->getData($url,'post',$post); |
||
865 | if ($data != '') { |
||
866 | $table = $Common->table2array($data); |
||
867 | $flight = $table; |
||
868 | if (isset($flight[5][4])) { |
||
869 | $arrivalTime = $flight[5][4]; |
||
870 | $arrivalAirport = $flight[5][3]; |
||
871 | } else { |
||
872 | $arrivalTime = ''; |
||
873 | $arrivalAirport = ''; |
||
874 | } |
||
875 | } else return array(); |
||
876 | $url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner'; |
||
877 | $json = $Common->getData($url); |
||
878 | if ($json == '') return array(); |
||
879 | $parsed_json = json_decode($json); |
||
880 | $airports = $parsed_json->{'suggestList'}; |
||
881 | if (count($airports) > 0) { |
||
882 | foreach ($airports as $airinfo) { |
||
883 | if ($airinfo->{'name'} == $departureAirport) { |
||
884 | $DepartureAirportIata = $airinfo->{'code'}; |
||
885 | } |
||
886 | if ($airinfo->{'name'} == $arrivalAirport) { |
||
887 | $ArrivalAirportIata = $airinfo->{'code'}; |
||
888 | } |
||
889 | } |
||
890 | } |
||
891 | if (isset($DepartureAirportIata)) { |
||
892 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
||
893 | } else return array(); |
||
894 | } |
||
895 | |||
896 | /* |
||
897 | * Fetch schedules from ident |
||
898 | * @param String $ident Flight ident |
||
899 | * @param String $date Date |
||
900 | * @return array Schedules info |
||
901 | */ |
||
902 | public function fetchSchedule($ident,$date = 'NOW') { |
||
903 | global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline, $globalFlightAwareUsername; |
||
904 | //$Common = new Common(); |
||
905 | if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array(); |
||
906 | $airline_icao = ''; |
||
907 | if (!is_numeric(substr($ident, 0, 3))) |
||
908 | { |
||
909 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
||
910 | $airline_icao = substr($ident, 0, 2); |
||
911 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
||
912 | $airline_icao = substr($ident, 0, 3); |
||
913 | } |
||
914 | } |
||
915 | if ($airline_icao != '') { |
||
916 | switch ($airline_icao) { |
||
917 | /* |
||
918 | // Adria Airways |
||
919 | case "ADR": |
||
920 | case "JP": |
||
921 | return Schedule->getStarAlliance($ident,$date,'JP'); |
||
922 | break; |
||
923 | // Aegean Airlines |
||
924 | case "AEE": |
||
925 | case "A3": |
||
926 | return Schedule->getStarAlliance($ident,$date,'A3'); |
||
927 | break; |
||
928 | // Air Canada |
||
929 | case "ACA": |
||
930 | case "AC": |
||
931 | return Schedule->getStarAlliance($ident,$date,'AC'); |
||
932 | break; |
||
933 | // Air China |
||
934 | case "CCA": |
||
935 | case "CA": |
||
936 | return Schedule->getStarAlliance($ident,$date,'CA'); |
||
937 | break; |
||
938 | // Air India |
||
939 | case "AIC": |
||
940 | case "AI": |
||
941 | return Schedule->getStarAlliance($ident,$date,'AI'); |
||
942 | break; |
||
943 | // Air New Zealand |
||
944 | case "ANZ": |
||
945 | case "NZ": |
||
946 | return Schedule->getStarAlliance($ident,$date,'NZ'); |
||
947 | break; |
||
948 | // All Nippon Airways |
||
949 | case "ANA": |
||
950 | case "NH": |
||
951 | return Schedule->getStarAlliance($ident,$date,'NH'); |
||
952 | break; |
||
953 | // Asiana Airlines |
||
954 | case "AAR": |
||
955 | case "OZ": |
||
956 | return Schedule->getStarAlliance($ident,$date,'OZ'); |
||
957 | break; |
||
958 | // Austrian |
||
959 | case "AUA": |
||
960 | case "OS": |
||
961 | return Schedule->getStarAlliance($ident,$date,'OS'); |
||
962 | break; |
||
963 | // Avianca |
||
964 | case "AVA": |
||
965 | case "AV": |
||
966 | return Schedule->getStarAlliance($ident,$date,'AV'); |
||
967 | break; |
||
968 | */ |
||
969 | // Brussels Airlines |
||
970 | case "BEL": |
||
971 | case "SN": |
||
972 | return $this->getBrussels($ident,$date); |
||
973 | /* |
||
974 | // Copa Airlines |
||
975 | case "CMP": |
||
976 | case "CM": |
||
977 | return Schedule->getStarAlliance($ident,$date,'CM'); |
||
978 | break; |
||
979 | // Croatia Airlines |
||
980 | case "CTN": |
||
981 | case "OU": |
||
982 | return Schedule->getStarAlliance($ident,$date,'OU'); |
||
983 | break; |
||
984 | // Egyptair |
||
985 | case "MSR": |
||
986 | case "MS": |
||
987 | return Schedule->getStarAlliance($ident,$date,'MS'); |
||
988 | break; |
||
989 | // Ethiopian Airlines |
||
990 | case "ETH": |
||
991 | case "ET": |
||
992 | return Schedule->getStarAlliance($ident,$date,'ET'); |
||
993 | break; |
||
994 | // Eva Air |
||
995 | case "EVA": |
||
996 | case "BR": |
||
997 | return Schedule->getStarAlliance($ident,$date,'BR'); |
||
998 | break; |
||
999 | // LOT Polish Airlines |
||
1000 | case "LOT": |
||
1001 | case "LO": |
||
1002 | return Schedule->getStarAlliance($ident,$date,'LO'); |
||
1003 | break; |
||
1004 | // Scandinavian Airlines |
||
1005 | case "SAS": |
||
1006 | case "SK": |
||
1007 | return Schedule->getStarAlliance($ident,$date,'SK'); |
||
1008 | break; |
||
1009 | // Shenzhen Airlines |
||
1010 | case "CSZ": |
||
1011 | case "ZH": |
||
1012 | return Schedule->getStarAlliance($ident,$date,'ZH'); |
||
1013 | break; |
||
1014 | // Singapore Airlines |
||
1015 | case "SIA": |
||
1016 | case "SQ": |
||
1017 | return Schedule->getStarAlliance($ident,$date,'SQ'); |
||
1018 | break; |
||
1019 | // South African Airways |
||
1020 | case "SAA": |
||
1021 | case "SA": |
||
1022 | return Schedule->getStarAlliance($ident,$date,'SA'); |
||
1023 | break; |
||
1024 | */ |
||
1025 | // SWISS |
||
1026 | case "SWR": |
||
1027 | case "LX": |
||
1028 | return $this->getSwiss($ident); |
||
1029 | |||
1030 | /* |
||
1031 | // TAP Portugal |
||
1032 | case "TAP": |
||
1033 | case "TP": |
||
1034 | return $this->getFlyTap($ident,$date); |
||
1035 | break; |
||
1036 | */ |
||
1037 | /* |
||
1038 | // Thai Airways International |
||
1039 | case "THA": |
||
1040 | case "TG": |
||
1041 | return Schedule->getStarAlliance($ident,$date,'TG'); |
||
1042 | break; |
||
1043 | // Turkish Airlines |
||
1044 | case "THY": |
||
1045 | case "TK": |
||
1046 | return Schedule->getStarAlliance($ident,$date,'TK'); |
||
1047 | break; |
||
1048 | // United |
||
1049 | case "UAL": |
||
1050 | case "UA": |
||
1051 | return Schedule->getStarAlliance($ident,$date,'UA'); |
||
1052 | break; |
||
1053 | */ |
||
1054 | // Air France |
||
1055 | /* |
||
1056 | case "AF": |
||
1057 | case "AFR": |
||
1058 | return $this->getAirFrance($ident,$date,'AF'); |
||
1059 | */ |
||
1060 | // HOP |
||
1061 | /* |
||
1062 | case "A5": |
||
1063 | case "HOP": |
||
1064 | return $this->getAirFrance($ident,$date,'A5'); |
||
1065 | */ |
||
1066 | // EasyJet |
||
1067 | case "U2": |
||
1068 | case "DS": |
||
1069 | case "EZY": |
||
1070 | case "EZS": |
||
1071 | return $this->getEasyJet($ident,$date); |
||
1072 | // Ryanair |
||
1073 | case "FR": |
||
1074 | case "RYR": |
||
1075 | return $this->getRyanair($ident); |
||
1076 | // British Airways |
||
1077 | case "BA": |
||
1078 | case "SHT": |
||
1079 | case "BAW": |
||
1080 | return $this->getBritishAirways($ident); |
||
1081 | // Tunisair |
||
1082 | case "TUI": |
||
1083 | case "TAR": |
||
1084 | case "TU": |
||
1085 | return $this->getTunisair($ident); |
||
1086 | // Vueling |
||
1087 | case "VLG": |
||
1088 | case "VY": |
||
1089 | return $this->getVueling($ident); |
||
1090 | // Alitalia |
||
1091 | /* |
||
1092 | case "AZ": |
||
1093 | case "AZA": |
||
1094 | return $this->getAlitalia($ident); |
||
1095 | */ |
||
1096 | // Air Canada |
||
1097 | case "ACA": |
||
1098 | case "AC": |
||
1099 | return $this->getAirCanada($ident); |
||
1100 | // Lufthansa |
||
1101 | case "DLH": |
||
1102 | case "LH": |
||
1103 | return $this->getLufthansa($ident); |
||
1104 | /* |
||
1105 | // Transavia |
||
1106 | case "TRA": |
||
1107 | case "HV": |
||
1108 | return $this->getTransavia($ident); |
||
1109 | break; |
||
1110 | */ |
||
1111 | /* |
||
1112 | case "DLH": |
||
1113 | case "LH": |
||
1114 | return $this->getStarAlliance($ident,$date,'LH'); |
||
1115 | break; |
||
1116 | */ |
||
1117 | // Iberia |
||
1118 | case "IBE": |
||
1119 | case "IB": |
||
1120 | return $this->getIberia($ident); |
||
1121 | // Vietnam Airlines |
||
1122 | case "HVN": |
||
1123 | return $this->getVietnamAirlines($ident,$date); |
||
1124 | // Air Berlin |
||
1125 | case "AB": |
||
1126 | case "BER": |
||
1127 | return $this->getAirBerlin($ident,$date,'AB'); |
||
1128 | // NIKI |
||
1129 | case "HG": |
||
1130 | case "NLY": |
||
1131 | return $this->getAirBerlin($ident,$date,'HG'); |
||
1132 | // BelAir |
||
1133 | case "4T": |
||
1134 | case "BHP": |
||
1135 | return $this->getAirBerlin($ident,$date,'4T'); |
||
1136 | default: |
||
1137 | if (strlen($airline_icao) == 3) { |
||
1138 | $Spotter = new Spotter($this->db); |
||
1139 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
||
1140 | if (isset($airline_info[0]['iata'])) $airline_icao = $airline_info[0]['iata']; |
||
1141 | } |
||
1142 | // Randomly use a generic function to get hours |
||
1143 | if (strlen($airline_icao) == 2) { |
||
1144 | if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightaware'); |
||
1145 | if (count($globalSchedulesSources) > 0) { |
||
1146 | $rand = mt_rand(0,count($globalSchedulesSources)-1); |
||
1147 | $source = $globalSchedulesSources[$rand]; |
||
1148 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
||
1149 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |
||
1150 | //elseif ($source == 'flightradar24') return $this->getFlightRadar24($ident,$date); |
||
1151 | elseif ($source == 'flightaware' && $globalFlightAwareUsername != '') return $this->getFlightAware($ident); |
||
1152 | } |
||
1153 | } |
||
1154 | } |
||
1155 | } |
||
1156 | return array(); |
||
1157 | } |
||
1158 | } |
||
1159 | |||
1160 | |||
1161 | //$Schedule = new Schedule(); |
||
1162 | |||
1163 | //print_r($Schedule->fetchSchedule('HV5661')); |
||
1164 | //print_r($Schedule->getCostToTravel('AB8788')); |
||
1165 | //print_r($Schedule->getBritishAirways('BAW551')); |
||
1166 | //print_r($Schedule->getLufthansa('LH551')); |
||
1167 | //print_r($Schedule->getTunisair('TU203')); |
||
1168 | //print_r($Schedule->getTransavia('TRA598')); |
||
1169 | //print_r($Schedule->getSkyTeam('AF7669')); |
||
1170 | |||
1171 | ?> |