PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Dave Smith   PHP Flight Schedules   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: PHP Flight Schedules
Get real time flight schedules using aviationStack
Author: By
Last change:
Date: 3 years ago
Size: 1,137 bytes


Class file image Download
example usage
aviationStack ver 1.0

You must get an API key from
and enter it in the aviationstack.class.php file

For complete documentation on each endpoint and available paramaters

//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);

//instantiate the class
$aviation = new aviationStack();

//set the end point to use

//set the parameters
//in this example, we are getting all flights departing from San Francisco
//and arriving in Dallas/Fort Worth

//show request
echo $aviation->buildRequest().'<br>';

//get the response

//check for errors
if( !empty($aviation->errorCode) ){
//error returned
echo $aviation->errorCode.': '.$aviation->errorText;

//displaying the full response
echo '<pre>';