2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00
Files
CATI_Tool/include/limesurvey/admin/classes/xmlrpc/doc/apa.html
azammitdcarf bfe3f2470f Added a backport of Limesurvey CI Remote Control 2 functionality for adding a response.
Can be used to insert a new response into a questionnaire via XML-RPC
Added xmlrpc package from: http://phpxmlrpc.sourceforge.net (new BSD licence compatible with GPL)
2011-11-11 05:26:58 +00:00

9 lines
6.5 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Integration with the PHP xmlrpc extension</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch12s09.html" title="Does the library support using cookies / http sessions?" /><link rel="next" href="apb.html" title="Appendix B. Substitution of the PHP xmlrpc extension" /></head><body><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="ch12s09.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" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="integration"></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"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">/***&nbsp;client&nbsp;side&nbsp;***/<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://phpxmlrpc.sourceforge.net/server.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;tell&nbsp;the&nbsp;client&nbsp;to&nbsp;return&nbsp;raw&nbsp;xml&nbsp;as&nbsp;response&nbsp;value<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'xml'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;let&nbsp;the&nbsp;native&nbsp;xmlrpc&nbsp;extension&nbsp;take&nbsp;care&nbsp;of&nbsp;encoding&nbsp;request&nbsp;parameters<br /></span><span style="color: #0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">xmlrpc_encode_request</span><span style="color: #007700">(</span><span style="color: #DD0000">'examples.getStateName'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'stateno'</span><span style="color: #007700">]));<br /><br />if&nbsp;(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;HTTP&nbsp;transport&nbsp;error<br />&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;error&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">();<br />else<br />{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;HTTP&nbsp;request&nbsp;OK,&nbsp;but&nbsp;XML&nbsp;returned&nbsp;from&nbsp;server&nbsp;not&nbsp;parsed&nbsp;yet<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xmlrpc_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">());<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;we&nbsp;got&nbsp;a&nbsp;valid&nbsp;xmlrpc&nbsp;response&nbsp;from&nbsp;server<br />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;invalid&nbsp;response'</span><span style="color: #007700">;<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;server&nbsp;sent&nbsp;a&nbsp;fault&nbsp;response<br />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">xmlrpc_is_fault</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;xmlrpc&nbsp;fault&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">[</span><span style="color: #DD0000">'faultCode'</span><span style="color: #007700">];<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;echo</span><span style="color: #DD0000">'Got&nbsp;response:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">);<br />}</span>
</span>
</code></pre></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s09.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">Does the library support using cookies / http sessions? </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>