Skip to content

Instantly share code, notes, and snippets.

@davidkryzaniak
Created March 28, 2014 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidkryzaniak/9835468 to your computer and use it in GitHub Desktop.
Save davidkryzaniak/9835468 to your computer and use it in GitHub Desktop.
<?php
//get the class
require_once('/path/to/flightaware/FlightAware.class.php');
$flightaware = new FlightAware();
/* Optionally, you can skip the config.ini and pass an array into the constructor
* $flightaware = new FlightAware(
* array("username"=>"","apiKey"=>"","requestURL"=>"flightxml.flightaware.com/json/FlightXML2/")
* );
*/
/* Now we can start making calls to the API. There are 2 ways to do this. (Note, proper casing is important!)
*
* $flightaware->NameOfAPICall(array("inputParameter"=>"Value"));
*
* OR
*
* $flightaware->request('NameOfAPICall',array("inputParameter"=>"Value"));
*/
//Let's see what the weather is like on the EAA grounds (KOSH)
//The FlightAware API documentation says "AirportInfo" takes in 1 parameter, "airportCode".
$eaaWeather = $flightaware->Metar(array("airport"=>"KOSH"));
//With out the magic method call
//$eaaWeather = $flightaware->request('Metar',array("airport"=>"KOSH"));
echo $eaaWeather["MetarResult"]; //great, it's snowing again...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment