This statically called method is actually the RPC client.
public static request ( string $driver, string | Horde_Url $url, string $method, mixed $client, array $params = null ) : mixed | ||
$driver | string | The protocol driver to use. Currently 'soap', 'xmlrpc' and 'jsonrpc' are available. |
$url | string | Horde_Url | The path to the RPC server on the called host. |
$method | string | The method to call. |
$client | mixed | An appropriate request client for the type of request. (Horde_Http_Request, SoapClient etc..) |
$params | array | A hash containing any necessary parameters for the method call. |
리턴 | mixed | The returned result from the method |
/** * Performs a listQueue API call. * * @throws Horde_Exception * @return array List of queues with IDs as key and information hash as * value. */ protected function _listQueues() { return Horde_Rpc::request('jsonrpc', $this->_params['url'], 'tickets.listSlugs', $this->_http, null)->result; }
function post_comment($ticket, $log_message) { $http = new Horde_Http_Client($GLOBALS['rpc_options']); try { $result = Horde_Rpc::request('xmlrpc', $GLOBALS['rpc_endpoint'], $GLOBALS['rpc_method'], $http, array((int) $ticket, $log_message)); } catch (Horde_Http_Exception $e) { abort($e->getMessage()); } catch (Horde_Rpc_Exception $e) { // Ignore } return true; }
<?php /** * @package Rpc */ die("Please configure the URL, username, and password, and then remove this line.\n"); // SOAP endpoint $rpc_endpoint = 'http://example.com/horde/rpc.php'; // SOAP method to call $rpc_method = 'calendar.listCalendars'; // SOAP options, usually username and password $rpc_options = array('login' => '', 'password' => '', 'namespace' => 'urn:horde', 'timeout' => 5, 'allowRedirects' => true, 'maxRedirects' => 3, 'location' => $rpc_endpoint, 'uri' => 'urn:horde', 'exceptions' => true, 'trace' => true); $soap = new SoapClient(null, $rpc_options); $result = Horde_Rpc::request('soap', $GLOBALS['rpc_endpoint'], $GLOBALS['rpc_method'], $soap, array()); var_dump($result);
<?php /** * @package Rpc */ die("Please configure the URL, username, and password, and then remove this line.\n"); // XML-RPC endpoint $rpc_endpoint = 'http://example.com/horde/rpc.php'; // XML-RPC method to call $rpc_method = 'calendar.listCalendars'; // XML-RPC options, usually username and password $rpc_options = array('request.username' => '', 'request.password' => ''); $http_client = new Horde_Http_Client($rpc_options); $result = Horde_Rpc::request('xmlrpc', $GLOBALS['rpc_endpoint'], $GLOBALS['rpc_method'], $GLOBALS['http_client'], array()); var_dump($result);