xmlrpc

Versions
4.6
xmlrpc()
4.7 – 7
xmlrpc($url)

Perform an XML-RPC request.

Parameters

$url An absolute URL of the XML-RPC server

$method The method to be executed

... A variable number of arguments of the method.

Return value

The return value of the method on success or FALSE. On FALSE, see xmlrpc_errno() and xmlrpc_error_msg().

▾ 4 functions call xmlrpc()

drupal_auth in modules/drupal.module
Implementation of hook_auth().
drupal_notify in modules/drupal.module
Sends a ping to the Drupal directory server.
ping_ping in modules/ping.module
Implementation of hook_ping().
xmlrpc_multicall in includes/xmlrpc.inc
Perform multiple calls in one request if possible.

Code

includes/xmlrpc.inc, line 376

<?php
function xmlrpc() {
  $args = func_get_args();
  $url = array_shift($args);
  $method = array_shift($args);
  $xmlrpc_request = xmlrpc_request($method, $args);
//  $request .= "Content-Type: text/xml$r";
  $result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml);
  if ($result->code != 200) {
    xmlrpc_error(-$result->code, $result->error);
    return FALSE;
  }
  $message = xmlrpc_message($result->data);
  // Now parse what we've got back
  if (!xmlrpc_message_parse($message)) {
    // XML error
    xmlrpc_error(-32700, t('parse error. not well formed'));
    return FALSE;
  }
  // Is the message a fault?
  if ($message->messagetype == 'fault') {
    xmlrpc_error($message->fault_code, $message->fault_string);
    return FALSE;
  }
  // Message must be OK
  return $message->params[0];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.