INCUTIO HOME | SCRIPTS | CONTACT

Manual Index

Advanced Client Construction

IXR_ClientMulticall is an extension to the IXR_Client class which provides a simple API for using system.multicall, an invaluable addition to the XML-RPC specification if you intend to make heavy use of web services. system.multicall allows clients to "pipeline" their procedure calls, sending an unlimited number of method requests in a single XML-RPC session (and thus with the overhead of only HTTP request rather than needing a separate request for every method). The system.multicall specification can be found here.

Here's how to use it:


$client = new IXR_ClientMulticall('http://scripts.incutio.com/xmlrpc/simpleserver.php');

$client->addCall('test.add', 2, 2);
$client->addCall('test.getTime');
$client->addCall('test.helloWorld');
$client->addCall('test.errorMsg');

if ($client->query()) {
    $response = $client->getResponse();
} else {
    echo "<h2>Error! ".$client->getErrorCode().":".$client->getErrorMessage().'</h2>';
}
print_r($response);

The return value will be an array, with each array item corresponding to a method call. These array items will themselves be single element arrays, each containing the actual value returned by the method. Any errors will be made available as structs (rather than single item arrays) to allow you to differentiate between errors and methods that return structs.

scripts.incutio.com light logo