xmlrpc.module in xmlrpc 8
Enables XML-RPC functionality.
File
xmlrpc.moduleView source
<?php
/**
* @file
* Enables XML-RPC functionality.
*/
use Drupal\Core\Url;
/**
* Implements hook_help().
*/
function xmlrpc_help($route_name) {
switch ($route_name) {
case 'help.page.xmlrpc':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The XML-RPC module gives external systems the opportunity to communicate with the site through the <a href=":url_definition">XML-RPC protocol</a>. An XML-RPC client can communicate with the site by making a request to <a href=":url_endpoint">xmlrpc</a>. For more information, see <a href=":url_docs">the online documentation for the XML-RPC module</a>.', [
':url_definition' => 'https://en.wikipedia.org/wiki/XML-RPC',
':url_endpoint' => Url::fromRoute('xmlrpc')
->toString(),
':url_docs' => 'https://drupal.org/documentation/modules/xmlrpc',
]) . '</p>';
return $output;
}
}
/**
* Performs one or more XML-RPC request(s).
*
* Usage example:
* @code
* $result = xmlrpc('http://example.com/xmlrpc', array(
* 'service.methodName' => array($parameter, $second, $third),
* ));
* @endcode
*
* @param string $url
* An absolute URL of the XML-RPC endpoint.
* @param array $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 array $headers
* (optional) An array of headers to pass along.
*
* @return mixed
* For one request:
* Either the return value of the method on success, or FALSE.
* If FALSE is returned, see xmlrpc_errno() and xmlrpc_error_msg().
* For multiple requests:
* An array of results. Each result will either be the result
* returned by the method called, or an xmlrpc_error object if the call
* failed. See xmlrpc_error().
*
* @ingroup third_party
*/
function xmlrpc($url, array $args, array $headers = []) {
module_load_include('inc', 'xmlrpc');
return _xmlrpc($url, $args, $headers);
}
Functions
Name | Description |
---|---|
xmlrpc | Performs one or more XML-RPC request(s). |
xmlrpc_help | Implements hook_help(). |