merge upstream phpxmlrpc
[plcapi.git] / php / phpxmlrpc / demo / client / which.php
1 <?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
2 <head><title>xmlrpc - Which toolkit demo</title></head>
3 <body>
4 <h1>Which toolkit demo</h1>
5 <h2>Query server for toolkit information</h2>
6 <h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3>
7 <p>You can see the source to this page here: <a href="which.php?showSource=1">which.php</a></p>
8 <?php
9
10 $req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
11 $client = new PhpXmlRpc\Client(XMLRPCSERVER);
12 $resp = $client->send($req);
13 if (!$resp->faultCode()) {
14     $encoder = new PhpXmlRpc\Encoder();
15     $value = $encoder->decode($resp->value());
16     print "Toolkit info:<br/>\n";
17     print "<pre>";
18     print "name: " . htmlspecialchars($value["toolkitName"]) . "\n";
19     print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n";
20     print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n";
21     print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n";
22     print "</pre>";
23 } else {
24     print "An error occurred: ";
25     print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n";
26 }
27 ?>
28 </body>
29 </html><?php require_once __DIR__ . "/_append.php"; ?>