git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_SGD/tags/3.7.0.2_original@1 eb19766c-00d9-a042-a3a0-45cb8ec72764
31 lines
3.0 KiB
HTML
31 lines
3.0 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>Appendix A. Integration with the PHP xmlrpc extension</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="XML-RPC for PHP"><link rel="up" href="index.html" title="XML-RPC for PHP"><link rel="prev" href="ch12s07.html" title="7. How can I save to a file the xml of the xmlrpc responses received from servers?"><link rel="next" href="apb.html" title="Appendix B. Substitution of the PHP xmlrpc extension"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. Integration with the PHP xmlrpc extension</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="apb.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3517"></a>Appendix A. Integration with the PHP xmlrpc extension</h2></div></div></div><p>To be documented more...</p><p>In short: for the fastest execution possible, you can enable the php native xmlrpc extension, and use it in conjunction with phpxmlrpc. The following code snippet gives an example of such integration</p><pre class="programlisting">
|
|
/*** client side ***/
|
|
$c = new xmlrpc_client('http://phpxmlrpc.sourceforge.net/server.php');
|
|
|
|
// tell the client to return raw xml as response value
|
|
$c->return_type = 'xml';
|
|
|
|
// let's the native xmlrpc extension take care of encoding request parameters
|
|
$r = $c->send(xmlrpc_encode_request('examples.getStateName', $_POST['stateno']));
|
|
|
|
if ($r->faultCode())
|
|
// HTTP transport error
|
|
echo 'Got error '.$r->faultCode();
|
|
else
|
|
{
|
|
// HTTP request OK, but XML returned from server not parsed yet
|
|
$v = xmlrpc_decode($r->value());
|
|
// check if we got a valid xmlrpc response from server
|
|
if ($v === NULL)
|
|
echo 'Got invalid response';
|
|
else
|
|
// check if server sent a fault response
|
|
if (xmlrpc_is_fault($v))
|
|
echo 'Got xmlrpc fault '.$v['faultCode'];
|
|
else
|
|
echo'Got response: '.htmlentities($v);
|
|
}
|
|
|
|
</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="apb.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. How can I save to a file the xml of the xmlrpc responses received from servers? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix B. Substitution of the PHP xmlrpc extension</td></tr></table></div></body></html> |