<body>
<h1>Agesort demo</h1>
<h2>Send an array of "name" => "age" pairs to the server that will send it back sorted.</h2>
-<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>
+<h3>The source code demonstrates basic lib usage, including manual creation of xml-rpc arrays and structs</h3>
+<p>Have a look at <a href="getstatename.php">getstatename.php</a> for automatic encoding and decoding, and at
+ <a href="../vardemo.php">vardemo.php</a> for more examples of manual encoding and decoding</p>
<p>You can see the source to this page here: <a href="agesort.php?showSource=1">agesort.php</a></p>
');
} else {
output("An error occurred:<pre>");
output("Code: " . htmlspecialchars($resp->faultCode()) .
- "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>');
+ "\nReason: '" . htmlspecialchars($resp->faultString()) . "'</pre><hr/>");
}
output("</body></html>\n");
/**
* A class taking advantage of cURL to send many requests in parallel (to a single server), for when the given server
- * does not support system.multicall method
+ * does not support the system.multicall method
*/
class ParallelClient extends Client
{
$client = new ParallelClient(XMLRPCSERVER);
$client->no_multicall = true;
+// a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and
+// using a single system.multiCall request
+
+echo "Making $num_tests xml-rpc calls...\n";
+flush();
+
$t = microtime(true);
$resp = $client->send($reqs);
$t = microtime(true) - $t;
-echo "Sequential send: $t secs\n";
+echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n";
+flush();
$t = microtime(true);
$resp = $client->sendParallel($reqs);
$t = microtime(true) - $t;
-echo "Parallel send: $t secs\n";
+echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n";
+flush();
$client->no_multicall = false;
$t = microtime(true);
$resp = $client->send($reqs);
$t = microtime(true) - $t;
-echo "Multicall send: $t secs\n";
+echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n";
}
/**
- * Translates any method call to an xmlrpc call.
+ * Translates any method call to an xml-rpc call.
*
* @author Toth Istvan
*
* @param string $name remote function name. Will be prefixed
* @param array $arguments
- *
* @return mixed
*
* @throws Exception
*
* @param string $name remote function name. Will be prefixed
* @param array $arguments
- *
* @return mixed
*
* @throws Exception
}
}
-$stateNo = rand(1, 51);
$proxy = new PhpXmlRpcProxy(new PhpXmlRpc\Client(XMLRPCSERVER));
+
+$stateNo = rand(1, 51);
+// sadly, no IDE will be able to assist with autocompletion for this method, unless you manually add an equivalent phpdoc comment...
$stateName = $proxy->getStateName($stateNo);
output("State $stateNo is ".htmlspecialchars($stateName));
<p>You can see the source to this page here: <a href="which.php?showSource=1">which.php</a></p>
');
-$req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
$client = new PhpXmlRpc\Client(XMLRPCSERVER);
+$req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
$resp = $client->send($req);
if (!$resp->faultCode()) {
$encoder = new PhpXmlRpc\Encoder();