XRL
2.0.0
Simple XML-RPC Library (both client and server)
|
A simple XML-RPC client. More...
Public Member Functions | |
__call ($method, array $args) | |
__construct ($baseURL,\fpoirotte\XRL\EncoderInterface $encoder=null,\fpoirotte\XRL\DecoderInterface $decoder=null, $context=null) | |
Protected Attributes | |
$baseURL | |
The remote XML-RPC server's base URL. | |
$context | |
A stream context to use when querying the server. | |
$decoder | |
Decoder for the response. | |
$encoder | |
Encoder for the request. | |
A simple XML-RPC client.
To call a remote XML procedure, create a new instance of this class (pass the server's URL to the constructor) and then simply call the procedure as if it was a method of the object returned:
In case the remote procedure's name is not a valid PHP identifier, you may still call it using the curly braces notation:
Definition at line 47 of file Client.php.
fpoirotte\XRL\Client::__construct | ( | $baseURL, | |
\fpoirotte\XRL\EncoderInterface | $encoder = null , |
||
\fpoirotte\XRL\DecoderInterface | $decoder = null , |
||
$context = null |
|||
) |
Create a new XML-RPC client.
string | $baseURL | Base URL for the XML-RPC server, eg. "http://www.example.com/xmlrpc/". |
fpoirotte::XRL::EncoderInterface | $encoder | (optional) Encoder to use for requests. If omitted, an encoder that accepts native PHP types, does not use indentation, but uses the <string> tags is automatically created using the machine's timezone. |
fpoirotte::XRL::DecoderInterface | $decoder | (optional) Decoder to use for responses. If omitted, a decoder that performs XML validation and converts values to native PHP types is automatically created using the machine's timezone. |
resource | $context | (optional) A PHP stream context to use when querying the remote XML-RPC server. |
InvalidArgumentException | The given timezone or context is invalid. |
Definition at line 95 of file Client.php.
References fpoirotte\XRL\Client\$baseURL, fpoirotte\XRL\Client\$context, fpoirotte\XRL\Client\$decoder, and fpoirotte\XRL\Client\$encoder.
fpoirotte\XRL\Client::__call | ( | $method, | |
array | $args | ||
) |
A magic method that forwards all method calls to the remote XML-RPC server and returns that server's response on success or throws an exception on failure.
string | $method | The remote procedure to call. |
array | $args | A list of arguments to pass to the remote procedure. |
mixed | The remote server's response, as a native type (string, int, boolean, float or DateTime object). |
fpoirotte::XRL::Exception | Raised in case the remote server's response indicates some kind of error. You may use this exception's getCode() and getMessage() methods to find out more about the error. |
RuntimeException | Raised when this client wasn't able to query the remote server (such as when no connection could be established to it). |
Definition at line 156 of file Client.php.