Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.03 KB

README.md

File metadata and controls

36 lines (27 loc) · 1.03 KB

Flight Durations (PHP)

Get actual flight durations using timezone information provided by OpenFlights.org.

Required parameters

  • from = departure datetime, i.e. 2016-11-10T16:25
  • to = arrival datetime, i.e. 2016-11-10T20:40
  • departureAirport = 3-letter IATA code of departure airport, i.e. AMS
  • destinationAirport = 3-letter IATA code of destinationairport, i.e. MIA

Sample requests

Start the builtin server using:

php -S localhost:9000 -t htdocs

Using Curlie:

$ curlie http://localhost:9000/ from==2016-11-10T16:25 to==2016-11-10T20:40 departureAirport==AMS destinationAirport==MIA
{
    "duration": "P0DT10H15M",
    "from": "2016-11-10T16:25+01:00",
    "to": "2016-11-10T20:40-05:00"
}

$ curlie http://localhost:9000/ from==2016-12-14T13:50 to==2016-12-15T06:50 departureAirport==ZRH destinationAirport==HKT
{
    "duration": "P0DT11H0M",
    "from": "2016-12-14T13:50+01:00",
    "to": "2016-12-15T06:50+07:00"
}