| 5 xmlrpc.inc | _xmlrpc() |
| 6 xmlrpc.inc | _xmlrpc() |
| 7 xmlrpc.inc | _xmlrpc($url, $args, $options = array()) |
| 8 xmlrpc.inc | _xmlrpc($url, $args, $options = array()) |
Execute an XML remote procedural call. This is private function; call xmlrpc() in common.inc instead of this function.
Return value
A $xmlrpc_message object if the call succeeded; FALSE if the call failed
1 string reference to '_xmlrpc'
File
- includes/
xmlrpc.inc, line 429
Code
function _xmlrpc() {
$args = func_get_args();
$url = array_shift($args);
xmlrpc_clear_error();
if (is_array($args[0])) {
$method = 'system.multicall';
$multicall_args = array();
foreach ($args[0] as $call) {
$multicall_args[] = array(
'methodName' => array_shift($call),
'params' => $call,
);
}
$args = array($multicall_args);
}
else {
$method = array_shift($args);
}
$xmlrpc_request = xmlrpc_request($method, $args);
$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