You are here

function xmlrpc_request in Drupal 7

Same name and namespace in other branches
  1. 4 includes/xmlrpc.inc \xmlrpc_request()
  2. 5 includes/xmlrpc.inc \xmlrpc_request()
  3. 6 includes/xmlrpc.inc \xmlrpc_request()

Constructs an object representing an XML-RPC request.

Parameters

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

$args: An array of parameters to send with the method.

Return value

object An XML-RPC object representing the request.

1 call to xmlrpc_request()
_xmlrpc in includes/xmlrpc.inc
Performs one or more XML-RPC requests.

File

includes/xmlrpc.inc, line 403
Drupal XML-RPC library.

Code

function xmlrpc_request($method, $args) {
  $xmlrpc_request = new stdClass();
  $xmlrpc_request->method = $method;
  $xmlrpc_request->args = $args;
  $xmlrpc_request->xml = <<<EOD
<?xml version="1.0"?>
<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;
}