You are here

function xmlrpc_request in xmlrpc 8

Constructs an object representing an XML-RPC request.

Parameters

string $method: The name of the method to be called.

array $args: An array of parameters to send with the method. May be empty but not NULL.

Return value

object An XML-RPC object representing the request.

2 calls to xmlrpc_request()
XmlRpcMessagesTest::testRequestAndResponseEncodingDefinitions in src/Tests/XmlRpcMessagesTest.php
Check XML-RPC client and server encoding information.
_xmlrpc in ./xmlrpc.inc
Performs one or more XML-RPC requests.

File

./xmlrpc.inc, line 398
Drupal XML-RPC library.

Code

function xmlrpc_request($method, array $args) {
  $xmlrpc_request = new stdClass();
  $xmlrpc_request->method = $method;
  $xmlrpc_request->args = $args;
  $xmlrpc_request->xml = <<<EOD
<?xml version="1.0" encoding="utf-8" ?>
<methodCall>
<methodName>{<span class="php-variable">$xmlrpc_request</span>-&gt;<span class="php-function-or-constant property member-of-variable">method</span>}</methodName>
<params>

EOD;
  foreach ($xmlrpc_request->args as $arg) {
    $xmlrpc_request->xml .= '<param><value>';
    $v = xmlrpc_value($arg);
    $xmlrpc_request->xml .= xmlrpc_value_get_xml($v);
    $xmlrpc_request->xml .= "</value></param>\n";
  }
  $xmlrpc_request->xml .= '</params></methodCall>';
  return $xmlrpc_request;
}