List all heavy aircraft

I’m trying to create a listing of both arriving and departing aircraft at a specified airport, but I want to filter by prefix H for heavy only.

Is there a way to do this with Enroute, Arrived, Scheduled and Departed that I’m not seeing?

SearchBirdseyeInFlight lets me filter by prefix using this query:{= prefix H} {= dest {KIAH}}, but doesn’t always return a result. Sometimes you get something, and sometimes it says there are no results. Am I just misreading the syntax?

For departures, I’m currently using Scheduled, but of course it returns everything, and so I’m filtering by a list of types, which unnecessarily returns all flights, putting extra load on the server.

$heavyAircraft = array(“B788”,“B77W”,“B763”,“B762”,“B772”,“B773”,“B789”,“A124”,“A225”,“IL76”);

Thanks!

Although most heavy flights properly file their flight plans with the correct prefix of “H”, it’s also probable that sometimes it omitted accidentally by whoever files the flight plan.

If you’re interested in those aircraft types, you can use SearchBirdseyeInFlight with something like:

“{= dest KIAH} {aircraftType {B788 B77W B763 B762 B772 B773 B789 A124 A225 IL76}} {true inAir}”

Thanks for the quick reply.

What I mean by sometimes there is no results, is that I can refresh and the flights that were displayed a few seconds ago, and that are still currently in the system, all of a sudden no longer show up, in fact the return is no flights at all.

Is there a way to get a list of all heavy aircraft types?

Thanks

I think you might be hitting a bug in SearchBirdseyeInFlight. I believe you should be able to use the Search function instead for your specific query, for functionally the same effect:

Search “-destination KIAH -type {B788 B77W B763 B762 B772 B773 B789 A124 A225 IL76} -inAir 1”

That’s not exposed in any direct way, but this is a list I just queried from our database, without any sanity checks:

777
A124
A225
A306
A30B
A310
A332
A333
A342
A343
A345
A346
A359
A388
A3ST
A50
AN22
B1
B2
B52
B703
B741
B742
B743
B744
B748
B74D
B74R
B74S
B762
B763
B764
B772
B773
B77L
B77W
B783
B788
B789
BLCF
BSCA
C135
C141
C17
C5
DC10
DC85
DC86
DC87
E3CF
E3TF
E6
E767
IL62
IL76
IL86
IL96
K35A
K35E
K35R
KE3
L101
MD11
MYA4
R135
T144
T160
TU95
VC10
VMT

Thank you!

Could you possibly do the same for all aircraft types with names? For example:

B789,Boeing 787-9
B763,Boeing 767-300
DC10,McDonnell Douglas DC-10

Is there a way to have the PHP return a JSON object rather than an array of objects to iterate through?

I’ve done some testing and with the Scheduled query for example, using PHP and looping through the SOAP array that I get back, takes about 1.5 seconds. Conversely, I tried it with the JQUERY example and I get it all back in about 0.0003 seconds.

I would like a way to use PHP to initiate the connection (so I don’t expose my API key), but then use JQUERY to get a JSON object back that can be parsed much faster than the SOAP array of objects that is returned via the PHP examples shown in the documentation.

I admit that I may be mincing terms and not completely understand what’s going on in the background, so feel free to enlighten me.

Thanks!

Okay, see below. Keep in mind that aircrafttype codes are not necessarily distinct, so there are actually multiple descriptions of aircraft that fit into any given code.

code | mfr | type
------±------------------±----------------------------------
777 | Boeing | 777
A124 | Antonov | Ruslan
A124 | Antonov | An-124 Ruslan
A225 | Antonov | An-225 Mriya
A225 | Antonov | Mriya
A306 | Airbus | A300B4-600
A306 | Airbus | A300F4-600
A306 | Airbus | A300C4-600
A30B | Airbus | A300B2-1
A30B | Airbus | A300B2
A30B | Airbus | A300B2-100
A30B | Airbus | A300B4-2
A30B | Airbus | A300B4-100
A30B | Airbus | A300B4-200
A30B | Airbus | A300C4-200
A30B | Airbus | A300F4-200
A30B | Airbus | A300B2K-3
A30B | Airbus | A300B2-200
A310 | Airbus | CC-150 Polaris
A310 | Airbus | A310
A310 | Airbus | Polaris
A332 | Airbus | A330-200
A333 | Airbus | A330-300
A342 | Airbus | A340-200
A343 | Airbus | A340-300
A345 | Airbus | A340-500
A346 | Airbus | A340-600
A359 | Airbus | A350-900
A388 | Airbus | A380-800
A3ST | Airbus | A300ST Super Transporter
A3ST | Airbus | A300ST Beluga
A3ST | Airbus | Beluga
A3ST | Airbus | Super Transporter
A3ST | SATIC | A-300ST Beluga
A3ST | SATIC | A-300ST Super Transporter
A3ST | SATIC | Beluga
A3ST | SATIC | Super Transporter
A50 | BERIEV | A-50
A50 | BERIEV | Be-976
A50 | Ilyushin | A-50
A50 | Ilyushin | Be-976
AN22 | Antonov | Antheus
AN22 | Antonov | An-22 Antheus
B1 | Rockwell | B-1 Lancer
B1 | Rockwell | Lancer
B2 | Northrop | B-2 Spirit
B2 | Northrop | Spirit
B2 | NORTHROP GRUMMAN | Spirit
B2 | NORTHROP GRUMMAN | B-2 Spirit
B52 | Boeing | B-52 Stratofortress
B52 | Boeing | Stratofortress
B703 | NORTHROP GRUMMAN | E-8 J-Stars
B703 | Boeing | KC-137
B703 | Boeing | J-Stars
B703 | Boeing | C-18
B703 | Boeing | EC-137
B703 | Boeing | EC-18
B703 | Boeing | E-8 J-Stars
B703 | Boeing | C-137
B703 | Boeing | T-17
B703 | IAI | 707 Phalcon
B703 | Grumman | J-Stars
B703 | IAI | Phalcon
B703 | Grumman | E-8 J-Stars
B703 | Boeing | 707-300
B703 | NORTHROP GRUMMAN | J-Stars
B741 | Boeing | 747-100
B742 | Boeing | VC-25
B742 | Boeing | E-4
B742 | Boeing | 747-200
B743 | Boeing | 747-300
B744 | Boeing | 747-400 (international, winglets)
B744 | Boeing | AL-1
B744 | Boeing | 747-400
B748 | Boeing | 747-8
B74D | Boeing | 747-400 (domestic, no winglets)
B74R | Boeing | 747SR
B74S | Boeing | 747SP
B762 | Boeing | 767-200
B763 | Boeing | 767-300
B764 | Boeing | 767-400
B772 | Boeing | 777-200
B773 | Boeing | 777-300
B77L | Boeing | 777-200LR/F
B77W | Boeing | 777-300ER
B783 | Boeing | 787-3
B788 | Boeing | 787-8
B789 | Boeing | 787-9
BLCF | Boeing | 747 Large Cargo Freighter
BSCA | Boeing | Shuttle Carrier
BSCA | Boeing | 747SCA Shuttle Carrier
C135 | Boeing | OC-135
C135 | Boeing | C-135B Stratolifter
C135 | Boeing | EC-135
C135 | Boeing | C-135K Stratolifter
C135 | Boeing | C-135E Stratolifter
C135 | Boeing | C-135C Stratolifter
C135 | Boeing | TC-135
C135 | Boeing | Stratolifter
C135 | Boeing | WC-135
C135 | Boeing | NKC-135
C141 | Lockheed | L-300 Starlifter
C141 | Lockheed | C-141 Starlifter
C141 | Lockheed | Starlifter
C17 | Boeing | C-17 Globemaster 3
C17 | Boeing | Globemaster III
C17 | McDonnell Douglas | C-17 Globemaster 3
C17 | McDonnell Douglas | Globemaster 3
C5 | Lockheed | Galaxy
C5 | Lockheed | C-5 Galaxy
C5 | Lockheed | L-500 Galaxy
DC10 | McDonnell Douglas | KDC-10
DC10 | McDonnell Douglas | KC-10 Extender
DC10 | McDonnell Douglas | DC-10
DC10 | Boeing | MD-10
DC10 | McDonnell Douglas | MD-10
DC10 | McDonnell Douglas | Extender
DC85 | McDonnell Douglas | DC-8-50
DC85 | Douglas | Jet Trader
DC85 | Douglas | DC-8-50 Jet Trader
DC85 | Douglas | DC-8-50
DC85 | McDonnell Douglas | Jet Trader
DC85 | McDonnell Douglas | DC-8-50 Jet Trader
DC86 | McDonnell Douglas | DC-8-60
DC86 | Douglas | DC-8-60
DC87 | McDonnell Douglas | DC-8-70
DC87 | Douglas | DC-8-70
E3CF | Boeing | Sentry (CFM56)
E3CF | Boeing | E-3D Sentry
E3CF | Boeing | E-3F Sentry
E3CF | Boeing | E-3A (CFM56) Sentry
E3TF | Boeing | E-3B Sentry
E3TF | Boeing | Sentry (TF33)
E3TF | Boeing | JE-3 Sentry
E3TF | Boeing | E-3C Sentry
E3TF | Boeing | E-3A (TF33) Sentry
E6 | Boeing | Mercury
E6 | Boeing | E-6 Mercury
E767 | Boeing | E-767
IL62 | Ilyushin | Il-62
IL76 | Ilyushin | Il-76
IL76 | Ilyushin | Il-82
IL76 | Ilyushin | Il-78
IL76 | Ilyushin | Il-76 Gajaraj
IL76 | Ilyushin | Gajaraj
IL86 | Ilyushin | Il-87
IL86 | Ilyushin | Il-86
IL96 | Ilyushin | Il-96
K35A | Boeing | KC-135A Stratotanker
K35A | Boeing | Stratotanker (J57 engines)
K35E | Boeing | KC-135D Stratotanker
K35E | Boeing | KC-135E Stratotanker
K35E | Boeing | Stratotanker (TF33 engines)
K35R | Boeing | Stratotanker (CFM56 engines)
K35R | Boeing | C-135FR Stratotanker
K35R | Boeing | KC-135R Stratotanker
K35R | Boeing | KC-135T Stratotanker
KE3 | Boeing | KE-3
L101 | Lockheed | L-1011 TriStar
L101 | Lockheed | TriStar
MD11 | McDonnell Douglas | MD-11
MD11 | Boeing | MD-11
MYA4 | MYASISHCHEV | 3M
MYA4 | MYASISHCHEV | M-4
R135 | Boeing | RC-135
T144 | TUPOLEV | Tu-144
T160 | TUPOLEV | Tu-160
TU95 | TUPOLEV | Tu-95
TU95 | TUPOLEV | Tu-20
TU95 | TUPOLEV | Tu-142
VC10 | VICKERS | VC-10
VC10 | BAC | VC-10
VMT | MYASISHCHEV | VM-T Atlant
VMT | MYASISHCHEV | Atlant

I would generally expect PHP to be just as fast as jQuery, probably even faster since server would probably have better connectivity than a typical web browsing user, though I haven’t specifically benchmarked the performance of the two at parsing SOAP vs JSON.

You can of course implement a JSON request in PHP, though you will just have to write a little bit more code to do do the HTTP GET and the JSON parse, the rather than simply relying on the SOAP package to do everything for you. Look at php.net/manual/en/function.json-decode.php

Thanks for the info! I agree that using SOAP coming from the server side should be much faster, please see below and tell me if I’m doing anything wrong. Is there a parameter that I can specify that tells it to return a JSON object rather than the array of objects?

The SOAP and JQUERY ones are just variations of the examples, using the Scheduled query.

Here’s my results.

PHP / SOAP: Takes 1.5 seconds


<?
$time_start = microtime(true);

$options = array(
	'trace' => true,
	'exceptions' => 0,
	'login' => 'username',
	'password' => 'api_key',
	'features' => SOAP_SINGLE_ELEMENT_ARRAYS
	);

$params = array(
	"airport" => "KIAH",
	"howMany" => 50,
	"offset" => 0,
	"filter" => ""
);

$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);

$result = $client->Scheduled($params);

print_r($result);

$time_end = microtime(true);
$time = number_format($time_end - $time_start,3);
echo "<p>Page load time: $time seconds</p>";
?>

JQUERY: Takes 1 ms.

Enter a flight ident to track:



All heavy departures from $airport

</table>
</body>
*********

cURL: Takes about 300ms.

[quote]

<?php $time_start = microtime(true);

// flightxml.flightaware.com/json/F … &offset=10

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://flightxml.flightaware.com/json/FlightXML2/Scheduled?airport=KIAH&howMany=50’);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_USERPWD, ‘username:api_key’);

$resp = curl_exec($curl);

print_r($resp);

curl_close($curl);
$time_end = microtime(true);
$time = number_format($time_end - $time_start,7);
echo “

Page load time: $time seconds

”;

?>

I’m not sure why the JQUERY one is so much faster, but also note that when I was testing this method the other day, it didn’t matter if I had 50 or 500 flights, it still did it in about 1 ms.

I’d appreciate any insight you can provide![/quote]

IdentTail NumberAirlineTypeGateDestinationScheduled departure time

Keep in mind that each time you construct a new SoapClient object, it must fetch the wsdl, parse all of the functions and structures in it (even the ones that you don’t intend to use), and then actually make the request that you want to make.

If you are able to write your application so that the SoapClient object is reused for all of the requests that you intend to make, then the perceived overhead should be slightly less. Instantiating a SoapClient object just for the purposes of making a single API call for benchmark purposes will include the extra startup overhead.

Thanks for that. I’ll do some rewriting and see what I come up with, but I still don’t see why that jquery version is so much faster.

Is JQUERY doing the same type of thing? Or is it not reading the entire WSDL? Do I have to read the entire WSDL to run it?

In the JQUERY one, it looks like I’m specifying the query that I want, I guess I’m not clear on why you have to read the entire WSDL listing just to run one function for SOAP.

Thanks!

WSDL is only used by SOAP clients. The jQuery method is using the JSON interface, so it doesn’t look at the WSDL at all.

Using SOAP generally means that you use a WSDL file so that you know how to construct the request and parse the response. The JSON/REST standard was designed as a lightweight alternative to the heavyweight overhead of SOAP.

So is there a recommended solution to instantiate the connection via PHP or some other closed source method, and then return and work with a JSON object? Is that the cURL method you mentioned?

cURL is fine if you want to use JSON from PHP. There are probably other PEAR modules that might provide other ways. This stackoverflow question provides some other ideas:
stackoverflow.com/questions/9802 … api-in-php

Thanks for the info.

What I want is the fastest way to retrieve data. So far, the JQUERY / JS method is the fastest, but of course it exposes my api key.

Any other suggestions on how to accomplish this would be appreciated! If cURL is it, then I’ll start moving forward with that.

Thanks!

Has something changed with regard to specifying multiple types using Search?

My code hasn’t changed, and I can no longer make this query:


http://flightxml.flightaware.com/json/FlightXML2/Search?query=-destination KIAH -type {B739 A319} -inAir 1&howMany=400

Or this one:


http://flightxml.flightaware.com/json/FlightXML2/Search?query=-destination KIAH -type {777 B772 B773 A124 A225 A306 A30B A310 A332 A333 A342 A343 A345 A346 A359 A388 A3ST A50 AN22 B1 B2 B52 B703 B741 B742 B743 B744 B748 B74D B74R B74S B762 B763 B764 B772 B773 B77L B77W B783 B788 B789 BLCF BSCA C135 C141 C17 C5 DC10 DC85 DC86 DC87 E3CF E3TF E6 E767 IL62 IL76 IL86 IL96 K35A K35E K35R KE3 L101 MD11 MYA4 R135 T144 T160 TU95 VC10 VMT} -inAir 1&howMany=400

This is the result:


{"SearchResult":{"next_offset":-1,"aircraft":]}}

However, if I only specify one type, it works fine, and of course I did verify that there are some of each type inbound to KIAH at the moment using this query:


http://flightxml.flightaware.com/json/FlightXML2/Search?query=-destination KIAH -inAir 1&howMany=400

Thanks!

Also, for anyone looking for a solution to use PHP with cURL utilizing JavaScript, this is what I did.

It is called from the JavaScript with a line like this, where you’re passing whatever query you want to make. It works extremely fast compared to SOAP.

For example:

myQuery = “Search?query=-destination KIAH -inAir 1&howMany=400”

XMLHttpRequest.open(“get”, “getdata.php?query=” + myQuery, true);

<?php switch ($_SERVER'HTTP_HOST']) { case "127.0.0.1": break; case "www.houstonspotters.net": break; default: exit(); } // Only allow execution from local dev environment or houstonspotters.net

date_default_timezone_set(‘America/Chicago’);

$query = $_SERVER"QUERY_STRING"];
// Removing the text query= from the query string.
$query = substr($query,6);

function queryFXML($url) {
$curl_time_start = microtime(true);
$curl = curl_init();
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_ENCODING, ‘’);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_USERPWD, ‘USERNAME:PASSWORD’);
curl_setopt($curl, CURLOPT_URL, $url);
$resp = curl_exec($curl);
$json = json_decode($resp, true);
return $json;
curl_close($curl);
$curl_time_end = microtime(true);
}

$json = queryFXML(“http://flightxml.flightaware.com/json/FlightXML2/” . $query);
print_r(json_encode($json));

?>

Can I please get some help on this?

Thanks!