FlightAware Discussions

MapFlight

Hello,

I got a problem with MapFlight in PHP.

I try :

$jsonObj = file_get_contents(‘http://MyUserName:MyKey@flightxml.flightaware.com/json/FlightXML2/MapFlight?ident=AFR3849&mapHeight=200&mapWidth=200’);

$final_res = json_decode($jsonObj);

return $final_res->MapFlightResult;

i have nothing !

Have you and example for Php with the function MapFlight ?

Thank you so much !

What does the image look like when you receive it? Is it an entirely blue image, or a null response, are you having trouble decoding the Base64 format?

Hi there! I’m doing the following in PHP:
$options = array(
‘trace’ => true,
‘exceptions’ => 0,
‘login’ => ‘myUser’,
‘password’ => ‘myKey’,
);
$client = new SoapClient(‘http://flightxml.flightaware.com/soap/FlightXML2/wsdl’, $options);
$params = array(“ident” => “UAL423”, “mapHeight” => 100, ‘mapWidth’ => 100);
$result = $client->MapFlight($params);
$data = base64_decode($result->MapFlightResult);

but I’m getting trash in data… there are wrong chars like this:
PNG

IHDRddIDATxMKTQo12jj9Ca[!zqӦ;08ANV(DADWZ8$"0_3$ӽN<aG=;}<$io

What am I doing wrong?

Thanks in advance!

The result of base64_decode() will be binary data that needs to be displayed to the user as a PNG image, typically by outputting it from PHP with header('Content-Type: image/png')