Help a Noob out


#1

Hi guys,

Really really new to the whole flightware and FlightXML scenario.

I have been tried to get my hands on the API but failed.
Below is my code.
Well it is exactly the code shown in the site, just replace the user name and password.



<?php
require_once( "nusoap/nusoap.php" );
$username = 'username';
$apiKey = 'password';
$baseUri = "http://flightxml.flightaware.com/soap/FlightXML2";
date_default_timezone_set('UTC');
$client = new nusoap_client("$baseUri/wsdl",'wsdl');
$client->setCredentials($username,$apiKey);
if ( $client->getError() ) {
    echo "Soap Constructor Error:" . $client->getError();
	exit;
}
// get the weather.
$params = array("airport" => "KAUS");
$result = $client->call( "Metar", $params);
if ($client->fault) { //soap_fault
    echo "Soap Fault: ". $client->fault->faultcode . "(" . $client->fault->faultstring . ")";
	exit;
}
elseif ( $client->getError() ) {
    echo "Soap Error: " . $client->getError();
	exit;
}
else {
    print_r($result);
}
?>


The issue is that SOAP throws an obvious error “Soap Error: HTTP Error: HTTP authentication failed”.
But the source I got it from keeps on insisting that the credentials are correct.
I am trying this from the local WAMP SERVER which has SOAP dll enabled as well.

Can you please be kind enough to skim through the code to check if there is any error…pretty please
Also, is there a free method to get the username and password without paying, atleast until the development phase is done?

Thanks a million in advance

Cheers
Elabuwa


#2

Make sure that in this line you are using a hexadecimal FlightXML API Key that was obtained from flightaware.com/commercial/flightxml/key and not just your website password:



$apiKey = 'password';


Most users find it easier and quicker to simply sign up for a normal paid FlightXML API Key (and adding a credit card to your account, if you haven’t already added one). There is no signup fee or minimum commitment, and we don’t make a billing attempt to your credit card until after you’ve accrued more than $5 of usage, which usually means several hundreds (or possibly thousands) of API requests. If you never reach that usage threshold and decide to not use our API anymore, no charge will be made. If you feel that you still require a free key, you can contact us and we can try to work out an arrangement for a time-limited trial account.


#3

Thanks B
Will give it a shot then