Trying PHP example

I am trying the PHP example with no joy.



<?php
 
        require_once('SOAP/Client.php');
 
        $DirectFlight_Authentication = array(
                'user'          => 'xxxxxxx',
                'pass'          => 'xxxxxxxxxxxxxx',
        );
 
	$wsdl_url = 'http://flightaware.com/commercial/directflight/data/wsdl1.xml';
 	$WSDL = new SOAP_WSDL($wsdl_url,$DirectFlight_Authentication);
 	$soap = $WSDL->getProxy();
 
 	$result = $soap->Enroute('KIAH',10,'airline',0);

	echo "<pre>";
	print_r ($result);
	echo "</pre>";
 
 php?>


I am getting this error:



soap_fault Object
(
    [error_message_prefix] => 
    [mode] => 1
    [level] => 1024
    

=> Parser
[message] => couldn’t build response
[userinfo] =>
[backtrace] => Array
(
[0] => Array
(
[file] => /usr/local/lib/php/SOAP/Fault.php
[line] => 49
[function] => pear_error
[class] => pear_error
[type] => ::
[args] => Array
(
[0] => couldn’t build response
[1] => Parser
[2] =>
[3] =>
[4] =>
)

            )

        [1] => Array
            (
                [file] => /usr/local/lib/php/SOAP/Base.php
                [line] => 199
                [function] => soap_fault
                [class] => soap_fault
                [type] => ->
                [args] => Array
                    (
                        [0] => couldn't build response
                        [1] => Parser
                        [2] => 
                        [3] => 
                        [4] => 
                        [5] => 
                    )

            )

        [2] => Array
            (
                [file] => /usr/local/lib/php/SOAP/Parser.php
                [line] => 471
                [function] => _raisesoapfault
                [class] => soap_parser
                [type] => ->
                [args] => Array
                    (
                        [0] => couldn't build response
                    )

            )

        [3] => Array
            (
                [file] => /usr/local/lib/php/SOAP/Client.php
                [line] => 542
                [function] => getresponse
                [class] => soap_parser
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [4] => Array
            (
                [file] => /usr/local/lib/php/SOAP/Client.php
                [line] => 281
                [function] => __parse
                [class] => webservice_directflight_directflightsoap
                [type] => ->
                [args] => Array
                    (
                        [0] => 
                        [1] => UTF-8
                        [2] => 
                    )

            )

        [5] => Array
            (
                [file] => /usr/local/lib/php/SOAP/WSDL.php(614) : eval()'d code
                [line] => 70
                [function] => call
                [class] => webservice_directflight_directflightsoap
                [type] => ->
                [args] => Array
                    (
                        [0] => Enroute
                        [1] => Array
                            (
                                [airport] => KIAH
                                [howMany] => 10
                                [filter] => airline
                                [offset] => 0
                            )

                        [2] => Array
                            (
                                [namespace] => FlightAwareDirectFlight
                                [soapaction] => FlightAwareDirectFlight
                                [style] => rpc
                                [use] => encoded
                            )

                    )

            )

        [6] => Array
            (
                [file] => /home/content/p/e/e/peepsnet/html/flightaware.php
                [line] => 14
                [function] => enroute
                [class] => webservice_directflight_directflightsoap
                [type] => ->
                [args] => Array
                    (
                        [0] => KIAH
                        [1] => 10
                        [2] => airline
                        [3] => 0
                    )

            )

    )

[callback] => 

)


I pasted that example into a file, replaced the authentication information, and ran it with PHP4 and it worked fine:


stdClass Object
(
    [next_offset] => 10
    [enroute] => Array
        (
            [0] => stdClass Object
                (
                    [ident] => COA1876
                    [aircrafttype] => B733
                    [actualdeparturetime] => 1169505480
                    [estimatedarrivaltime] => 1169516160
                    [origin] => KPIT
                    [destination] => KIAH
                    [originName] => Pittsburgh Int'l
                    [originCity] => Pittsburgh, PA
                    [destinationName] => George Bush Intctl Houston
                    [destinationCity] => Houston, TX
                )

            [1] => stdClass Object
                (
                    [ident] => COA551
                    [aircrafttype] => B735
                    [actualdeparturetime] => 1169506080
                    [estimatedarrivaltime] => 1169516160
                    [origin] => KRDU
                    [destination] => KIAH
                    [originName] => Raleigh Durham Int'l
                    [originCity] => Raleigh, NC
                    [destinationName] => George Bush Intctl Houston
                    [destinationCity] => Houston, TX
                )
(snip)


Upgrade your packages/dependencies?

This was the issue but I am not able to upgrade as I am on a shared server.

As a help to others here is the way I fixed it.

I downloaded the pear SOAP package from:
http://pear.php.net/package/SOAP

Then the HTTP_Request package from:
http://pear.php.net/package/HTTP_Request/

Then the Net_URLpackage from:
http://pear.php.net/package/Net_URL

I then placed each package in the APPLICATION ROOT
I.E.
www.website.com/application/flightaware.php
www.website.com/application/SOAP
www.website.com/application/Net
www.website.com/application/HTTP

This worked for my limited application but it might help those on shared servers.

Don