You are here

function xmlrpc_request in Drupal 5

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

Construct 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

1 call to xmlrpc_request()
_xmlrpc in includes/xmlrpc.inc
Execute an XML remote procedural call. This is private function; call xmlrpc() in common.inc instead of this function.

File

includes/xmlrpc.inc, line 323

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;
}