Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrcgrtz/flight-durations

✈️ Get actual flight durations using timezone information from OpenFlights.org.
https://github.com/mrcgrtz/flight-durations

flight-durations openflights timezone-information

Last synced: 23 days ago
JSON representation

✈️ Get actual flight durations using timezone information from OpenFlights.org.

Awesome Lists containing this project

README

        

# Flight Durations (PHP)

Get actual flight durations using [timezone information](https://openflights.org/data.html) 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:

```shell
php -S localhost:9000 -t htdocs
```

Using [Curlie](https://github.com/rs/curlie):

```shell
$ 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"
}
```