6 lines
9.7 KiB
HTML
6 lines
9.7 KiB
HTML
|
|
<html><head>
|
||
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
|
<title>2. xmlrpcmsg</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="ch07.html" title="Chapter 7. Class documentation"><link rel="prev" href="ch07s01.html" title="1. xmlrpcval"><link rel="next" href="ch07s03.html" title="3. xmlrpc_client"></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">2. xmlrpcmsg</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s01.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xmlrpcmsg"></a>2. xmlrpcmsg</h2></div></div></div><p>This class provides a representation for a request to an XML-RPC server. A client sends an <code class="classname">xmlrpcmsg</code> to a server, and receives back an <code class="classname">xmlrpcresp</code> (see <a href="ch07s03.html#xmlrpc-client-send">xmlrpc_client->send</a>).</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1373"></a>2.1. Creation</h3></div></div></div><p>The constructor takes the following forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$msg = new <b class="fsfunc">xmlrpcmsg</b>(</code></td><td><var class="pdparam">$methodName</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">$parameterArray</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$methodName</var>;</code></td></tr><tr><td><code>array</code> </td><td><code><var class="pdparam">$parameterArray</var>null;</code></td></tr></table></div><p>Where <em class="parameter"><code>methodName</code></em> is a string indicating the name of the method you wish to invoke, and <em class="parameter"><code>parameterArray</code></em> is a simple php <code class="classname">Array</code> of <code class="classname">xmlrpcval</code> objects. Here's an example message to the <span class="emphasis"><em>US state name</em></span> server:</p><pre class="programlisting">
|
||
|
|
$msg = new xmlrpcmsg("examples.getStateName", array(new xmlrpcval(23, "int")));
|
||
|
|
|
||
|
|
</pre><p>This example requests the name of state number 23. For more information on <code class="classname">xmlrpcval</code> objects, see <a href="ch07s01.html">xmlrpcval</a>.</p><p>Note that the <em class="parameter"><code>parameterArray</code></em> parameter is optional and can be omitted for methods that take no input parameters or if you plan to add parameters one by one.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1427"></a>2.2. Methods</h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1430"></a>2.2.1. addParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$ok = $msg-><b class="fsfunc">addParam</b>(</code></td><td><var class="pdparam">$xmlrpcVal</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>xmlrpcval</code> </td><td><code><var class="pdparam">$xmlrpcVal</var>;</code></td></tr></table></div><p>Adds the <code class="classname">xmlrpcval</code> <em class="parameter"><code>xmlrpcVal</code></em> to the parameter list for this method call. Returns TRUE or FALSE on error.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1452"></a>2.2.2. getNumParams</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$n = $msg-><b class="fsfunc">getNumParams</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><p>Returns the number of parameters attached to this message.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1464"></a>2.2.3. getParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$xmlrpcVal = $msg-><b class="fsfunc">getParam</b>(</code></td><td><var class="pdparam">$n</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>int</code> </td><td><code><var class="pdparam">$n</var>;</code></td></tr></table></div><p>Gets the <em class="parameter"><code>n</code></em>th parameter in the message (with the index zero-based). Use this method in server implementations to retrieve the values sent by the client.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1483"></a>2.2.4. method</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$methName = $msg-><b class="fsfunc">method</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$msg->method(</code></td><td><var class="pdparam">$methName</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$methName</var>;</code></td></tr></table></div><p>Gets or sets the method contained in the XML-RPC message.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1503"></a>2.2.5. parseResponse</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$response = $msg-><b class="fsfunc">parseResponse</b>(</code></td><td><var class="pdparam">$xmlString</var
|