# HTTP Response 401 Authentication Failed

**URL:** <https://discussions.flightaware.com/t/http-response-401-authentication-failed/9697>\
**Category:** AeroAPI\
**Created:** [March 27, 2010, 11:57pm UTC](https://discussions.flightaware.com/t/http-response-401-authentication-failed/9697 "2010-03-27T23:57:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dotlogy](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dotlogy](https://discussions.flightaware.com/u/dotlogy)\
**Post date:** [March 27, 2010, 11:57pm UTC](https://discussions.flightaware.com/t/http-response-401-authentication-failed/9697/1 "2010-03-27T23:57:29Z")

</div>

when i **“print $result;”** I am getting this error… **“HTTP Response 401 Authentication Failed”**

\<?php ini\_set('include\_path', '.:/usr/lib/php:/usr/local/lib/php:/home/shersoft/php'); require\_once('SOAP/Client.php'); $DirectFlight\_Authentication = array( 'user' =\> '\*\*\*concealed username\*\*\*', 'pass' =\> '\*\*\*concealed activation key\*\*\*', ); $wsdl\_url = 'http://flightaware.com/commercial/flightxml/data/wsdl1.xml'; $WSDL = new SOAP\_WSDL($wsdl\_url,$DirectFlight\_Authentication); $soap = $WSDL-\>getProxy(); $result = $soap-\>Enroute('KIAH',10,'airline',0); \*\*print $result;\*\* print "Aircraft en route to KSMO: "; $flights = $result-\>enroute; foreach ($flights as $flight) { print $flight-\>ident . " (" . $flight-\>aircrafttype . ") " . $flight-\>originName . " (" . $flight-\>origin . ") "; } ?\>

HTTP Response 401 Authentication FailedAircraft en route to KSMO:  
Warning: Invalid argument supplied for foreach() in /home/shersoft/public\_html/testflightapi.php on line 23

---

<div class="post-metadata">

**Author:** ![mduell](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/mduell/32/115680_2.png) [@mduell](https://discussions.flightaware.com/u/mduell)\
**Post date:** [March 28, 2010, 12:40am UTC](https://discussions.flightaware.com/t/http-response-401-authentication-failed/9697/2 "2010-03-28T00:40:49Z")

</div>

You need a [FlightXML key](http://flightaware.com/commercial/flightxml/key) for the password.
