PHP Class Prado\Util\TRpcClient

Note: When using setIsNotification(true), *every* following request is also considered to be a notification until you use setIsNotification(false). Usage: First, you can use the factory:
$_rpcClient = TRpcClient::create('xml', 'http://host/server');
$_result = $_rpcClient->remoteMethodName($param, $otherParam);
or as oneliner:
$_result = TRpcClient::create('json', 'http://host/server')->remoteMethod($param, ...);
Second, you can also use the specific implementation directly:
$_rpcClient = new TXmlRpcClient('http://host/server');
$_result = $_rpcClient->remoteMethod($param, ...);
or as oneliner:
$_result = TXmlRpcClient('http://host/server')->hello();
Since: 3.2
Author: Robin J. Rogge ([email protected])
Inheritance: extends Prado\TApplicationComponent
Datei anzeigen Open project: pradosoft/prado

Public Methods

Method Description
__construct ( $serverUrl, $isNotification = false )
create ( $type, $serverUrl, $isNotification = false ) : TRpcClient Creates an instance of the requested RPC client type
getIsNotification ( ) : boolean
getServerUrl ( ) : string
setIsNotification ( $bool )
setServerUrl ( $value )

Protected Methods

Method Description
createStreamContext ( mixed $content, string $contentType ) Creates a stream context resource
performRequest ( $serverUrl, $payload, $mimeType ) Performs the actual request

Method Details

__construct() public method

public __construct ( $serverUrl, $isNotification = false )

create() public static method

Creates an instance of the requested RPC client type
public static create ( $type, $serverUrl, $isNotification = false ) : TRpcClient
return TRpcClient instance

createStreamContext() protected method

Creates a stream context resource
protected createStreamContext ( mixed $content, string $contentType )
$content mixed
$contentType string mime type

getIsNotification() public method

public getIsNotification ( ) : boolean
return boolean whether requests are considered to be notifications (completely ignoring the response)

getServerUrl() public method

public getServerUrl ( ) : string
return string url of the RPC server

performRequest() protected method

Performs the actual request
protected performRequest ( $serverUrl, $payload, $mimeType )

setIsNotification() public method

public setIsNotification ( $bool )

setServerUrl() public method

public setServerUrl ( $value )