[phpxmlrpc] Search Example

Gaetano Giunta giunta.gaetano at gmail.com
Sun Aug 26 18:58:01 BST 2007


Here is some sample code to get you started.
Please take some time to
1 - get some basic knowledge of the xmlrpc protocol
2 - read the documentation that specifies the bookings.com API

<?php

include("xmlrpc.inc");

$xmlrpc_client =3D new xmlrpc_client('
http://www.bookings.com/xmlrpcqueryserver');

// use this to have a complete dump of the xmlrpc transaction on the screen
$xmlrpc_client->setDebug(2);

// the actual parameters to be used in calling the remote method depend on
the specific API exposed by the server
$xmlrpc_msg =3D new xmlrpcmsg('bookings.getCountries');
$xmlrpc_msg->addParam(new xmlrpcval('NZ','string'));
$xmlrpc_msg->addParam(new xmlrpcval(0,'int'));

$xmlrpc_resp =3D $xmlrpc_client->send($xmlrpc_msg);

// remember to check for errors in the received response
if ($xmlrpc_resp->faultCode()) {
    print "Fault: Code: ".$xmlrpc_resp->faultCode();
    print " Reason '".$xmlrpc_resp->faultString();
} else {
    $decoded_response =3D php_xmlrpc_decode($xmlrpc_resp->value());
    print "Response: ".$decoded_response;
}

?>

Bye
Gaetano


On 8/21/07, Jongilanga Guma <jongi at ilikeit.co.za> wrote:
>
> Hello,
>
> I need a php example script that does a search, I have a pool on
> bookings.com where I can search for hotel bookings country, cities,
> etc. I am a newbie on xml.
>
> I have my methods for example bookings.getCountries, that returns:
> <methodResponse>
> <param>
> <params>
> <value>
> <struct>
> <member><name>name</name>
> <value><string>New Zealand</string></value>
> </me




mber>
> <member><name>languagecode</name>
> <value><string>da</string></value>
> </member>
> </struct>
> </value>
> </params>
> </param>
> </methodResponse>
>
> Apologizes if this is not irrelevant to this list,
>
> Regards,
> Jongi
> _______________________________________________
> phpxmlrpc mailing list
> phpxmlrpc at lists.usefulinc.com
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20070826/8c=
3816ad/attachment.htm


More information about the phpxmlrpc mailing list