Basic UsageΒΆ
Following a quick and dirty example of lib basic usage.
Note
For more detailed informations, please see Using the client and Composing requests pages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <?php
use \Comodojo\RpcClient\RpcClient;
use \Comodojo\RpcClient\RpcRequest;
use \Exception;
try {
// create a RpcClient instance (default XML)
$client = new RpcClient( "http://phpxmlrpc.sourceforge.net/server.php" );
// create and inject a request
$client->addRequest( RpcRequest::create("echo", ['Hello Comodojo!']) );
// send the request
$result = $client->send();
} catch (Exception $e) {
/* something did not work :( */
throw $e;
}
echo $result;
|