Re: Search Example

"Gaetano Giunta" <[email protected]> Sun, 26 Aug 2007 19:58:01 +0200
Newsgroups gmane.comp.php.xml-rpc
Message-ID <[email protected]>
--===============1167832491==
Content-Type: multipart/alternative; 
	boundary="----=_Part_133467_20436726.1188151081088"

------=_Part_133467_20436726.1188151081088
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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 = 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 = new xmlrpcmsg('bookings.getCountries');
$xmlrpc_msg->addParam(new xmlrpcval('NZ','string'));
$xmlrpc_msg->addParam(new xmlrpcval(0,'int'));

$xmlrpc_resp = $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 = php_xmlrpc_decode($xmlrpc_resp->value());
    print "Response: ".$decoded_response;
}

?>

Bye
Gaetano


On 8/21/07, Jongilanga Guma <[email protected]> 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
> [email protected]
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>

------=_Part_133467_20436726.1188151081088
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Here is some sample code to get you started.<br>Please take some time to<br>1 - get some basic knowledge of the xmlrpc protocol<br>2 - read the documentation that specifies the <a href="http://bookings.com">bookings.com</a>
 API<br><br>&lt;?php<br><br>include(&quot;xmlrpc.inc&quot;);<br><br>$xmlrpc_client = new xmlrpc_client(&#39;<a href="http://www.bookings.com/xmlrpcqueryserver&#39;">http://www.bookings.com/xmlrpcqueryserver&#39;</a>);<br>
<br>// use this to have a complete dump of the xmlrpc transaction on the screen<br>$xmlrpc_client-&gt;setDebug(2);<br><br>// the actual parameters to be used in calling the remote method depend on the specific API exposed by the server
<br>$xmlrpc_msg = new xmlrpcmsg(&#39;bookings.getCountries&#39;);<br>$xmlrpc_msg-&gt;addParam(new xmlrpcval(&#39;NZ&#39;,&#39;string&#39;));<br>$xmlrpc_msg-&gt;addParam(new xmlrpcval(0,&#39;int&#39;));<br><br>$xmlrpc_resp = $xmlrpc_client-&gt;send($xmlrpc_msg);
<br><br>// remember to check for errors in the received response<br>if ($xmlrpc_resp-&gt;faultCode()) {<br>&nbsp;&nbsp;&nbsp; print &quot;Fault: Code: &quot;.$xmlrpc_resp-&gt;faultCode();<br>&nbsp;&nbsp;&nbsp; print &quot; Reason &#39;&quot;.$xmlrpc_resp-&gt;faultString();
<br>} else {<br>&nbsp;&nbsp;&nbsp; $decoded_response = php_xmlrpc_decode($xmlrpc_resp-&gt;value());<br>&nbsp;&nbsp;&nbsp; print &quot;Response: &quot;.$decoded_response;<br>}<br><br>?&gt;<br><br>Bye<br>Gaetano<br><br><br><div><span class="gmail_quote">
On 8/21/07, <b class="gmail_sendername">Jongilanga Guma</b> &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I need a php example script that does a search, I have a pool on<br><a href="http://bookings.com">bookings.com</a> where I can search for hotel bookings country, cities,<br>etc. I am a newbie on xml.<br><br>
I have my methods for example bookings.getCountries, that returns:<br>&lt;methodResponse&gt;<br>&lt;param&gt;<br>&lt;params&gt;<br>&lt;value&gt;<br>&lt;struct&gt;<br>&lt;member&gt;&lt;name&gt;name&lt;/name&gt;<br>&lt;value&gt;&lt;string&gt;New Zealand&lt;/string&gt;&lt;/value&gt;
<br>&lt;/me</blockquote><div><br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">mber&gt;<br>&lt;member&gt;&lt;name&gt;languagecode&lt;/name&gt;
<br>&lt;value&gt;&lt;string&gt;da&lt;/string&gt;&lt;/value&gt;<br>&lt;/member&gt;<br>&lt;/struct&gt;<br>&lt;/value&gt;<br>&lt;/params&gt;<br>&lt;/param&gt;<br>&lt;/methodResponse&gt;<br><br>Apologizes if this is not irrelevant to this list,
<br><br>Regards,<br>Jongi<br>_______________________________________________<br>phpxmlrpc mailing list<br><a href="mailto:[email protected]">[email protected]</a><br><a href="http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc">
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc</a><br></blockquote></div><br>

------=_Part_133467_20436726.1188151081088--

--===============1167832491==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
phpxmlrpc mailing list
[email protected]
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc

--===============1167832491==--