Created
March 28, 2014 15:30
-
-
Save davidkryzaniak/9835468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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