summaryrefslogtreecommitdiff
path: root/includes/xmlrpc.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-14 03:15:01 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-14 03:15:01 +0000
commit0a481a7899ee903994a2c9cf3c8cc7bc9b9bf5f6 (patch)
tree547038f8c47beada9840f0bfcde809349cc9eff1 /includes/xmlrpc.inc
parent8f7eae302e5653b752e25d95ba1b5ba597727134 (diff)
downloadbrdo-0a481a7899ee903994a2c9cf3c8cc7bc9b9bf5f6.tar.gz
brdo-0a481a7899ee903994a2c9cf3c8cc7bc9b9bf5f6.tar.bz2
- Patch #881536 by sun, pwolanin: cannot pass drupal_http_request() options into xmlrpc() function.
Diffstat (limited to 'includes/xmlrpc.inc')
-rw-r--r--includes/xmlrpc.inc40
1 files changed, 19 insertions, 21 deletions
diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc
index 30dee3ac5..40b0d9d03 100644
--- a/includes/xmlrpc.inc
+++ b/includes/xmlrpc.inc
@@ -528,14 +528,14 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
* Performs one or more XML-RPC requests.
*
* @param $url
- * The absolute URL of the XML-RPC endpoint. Example:
- * http://www.example.com/xmlrpc.php
- * @param ...
- * - For one request: The method name followed by a variable number of
- * arguments to the method.
- * - For multiple requests (system.multicall): An array of call arrays. Each
- * call array follows the pattern of the single request: method name
- * followed by the arguments to the method.
+ * An absolute URL of the XML-RPC endpoint, e.g.,
+ * http://example.com/xmlrpc.php
+ * @param $args
+ * An associative array whose keys are the methods to call and whose values
+ * are the arguments to pass to the respective method. If multiple methods
+ * are specified, a system.multicall is performed.
+ * @param $options
+ * (optional) An array of options to pass along to drupal_http_request().
*
* @return
* A single response (single request) or an array of responses (multicall
@@ -544,27 +544,25 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
* is returned, see xmlrpc_errno() and xmlrpc_error_msg() to get more
* information.
*/
-function _xmlrpc() {
- $args = func_get_args();
- $url = array_shift($args);
+function _xmlrpc($url, $args, $options = array()) {
xmlrpc_clear_error();
- if (is_array($args[0])) {
- $method = 'system.multicall';
+ if (count($args) > 1) {
$multicall_args = array();
- foreach ($args[0] as $call) {
- $multicall_args[] = array('methodName' => array_shift($call), 'params' => $call);
+ foreach ($args as $method => $call) {
+ $multicall_args[] = array('methodName' => $method, 'params' => $call);
}
+ $method = 'system.multicall';
$args = array($multicall_args);
}
else {
- $method = array_shift($args);
+ $method = key($args);
+ $args = $args[$method];
}
$xmlrpc_request = xmlrpc_request($method, $args);
- $options = array(
- 'headers' => array('Content-Type' => 'text/xml'),
- 'method' => 'POST',
- 'data' => $xmlrpc_request->xml,
- );
+ // Required options which will replace any that are passed in.
+ $options['method'] = 'POST';
+ $options['headers']['Content-Type'] = 'text/xml';
+ $options['data'] = $xmlrpc_request->xml;
$result = drupal_http_request($url, $options);
if ($result->code != 200) {
xmlrpc_error($result->code, $result->error);