"Search" Request Not Working

I’ve been having some issues getting “Search” requests to work. The documentation is a little light and can’t seem to find much on the forums. I’m trying to get flight activity between two destinations for any airline (excluding light aircraft).

This is my sample query in PHP:

$params = array( “query” => “-prefix H -destination FSD -origin MSP”, “howMany” => 15, “offset” => 0 );
$result = $client->Search($params);

I’m getting back an empty response via the API. So clearly there is something wrong with this query. However, I can’t seem to get it to work with various alterations. Any ideas?

Try again but using ICAO codes for the airports.

“-prefix H -destination KFSD -origin KMSP”

Still nothing. This is the exact code I’m using. Just returns an empty array. I’m not sure if this feature is actually working. As the parameters appear correct.


$apikey = 'my-api-key-is-here';
$user = 'my-username-is-here';
$options = array(
    'trace' => true,
    'exceptions' => 0,
    'login' => $user,
    'password' => $apikey,
);
$client= new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);  

$params = array( "query" => "-prefix H -destination KJFK -origin KMSP", "howMany" => 10, "offset" => 0 );
$result = $client->Search($params);
print_r($result); 

The result returned is this. Essentially an empty result set.:


[SearchResult] => stdClass Object([next_offset] => -1)

The prefix might not always be set to H for those flights, which is dependent upon ATC or flight planning entering the code properly each time. Also be aware that by default only currently flying flights will be returned, and that route has only about 7 daily flights so you might not always be calling it when there is a flight in progress.

If you search for “-destination KFSD -origin KMSP -inAir 0” then you can see a few of the past flights.

If you know the specific flight numbers you’re interested in, FlightInfoEx will generally provide you with a little more details about actual status.