<?php
/*
example usage
aviationStack ver 1.0
You must get an API key from https://aviationstack.com/product
and enter it in the aviationstack.class.php file
For complete documentation on each endpoint and available paramaters
see https://aviationstack.com/documentation
*/
//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);
//instantiate the class
include('aviationstack.class.php');
$aviation = new aviationStack();
//set the end point to use
$aviation->setEndPoint('flights');
//set the parameters
//in this example, we are getting all flights departing from San Francisco
//and arriving in Dallas/Fort Worth
$aviation->setParam('flight_date','2019-12-30');
$aviation->setParam('dep_iata','SFO');
$aviation->setParam('arr_iata','DFW');
//show request
echo $aviation->buildRequest().'<br>';
//get the response
$aviation->getResponse();
//check for errors
if( !empty($aviation->errorCode) ){
//error returned
echo $aviation->errorCode.': '.$aviation->errorText;
}
//displaying the full response
echo '<pre>';
var_dump($aviation->response);
echo '<pre>';
?>
|