tests
[plcapi.git] / demo / client / which.php
index 0699c8b..6664e2f 100644 (file)
@@ -1,32 +1,29 @@
-<html>\r\r
-<head><title>xmlrpc</title></head>\r\r
-<body>\r\r
-<h1>Which toolkit demo</h1>\r\r
-<h2>Query server for toolkit information</h2>\r\r
-<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>\r\r
-<?php\r\r
-       include("xmlrpc.inc");\r\r
-\r\r
-       $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());\r\r
-       $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r
-       $r = $c->send($f);\r\r
-       if(!$r->faultCode())\r\r
-       {\r\r
-               $v = php_xmlrpc_decode($r->value());\r\r
-               print "<pre>";\r\r
-               print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";\r\r
-               print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";\r\r
-               print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";\r\r
-               print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";\r\r
-               print "</pre>";\r\r
-       }\r\r
-       else\r\r
-       {\r\r
-               print "An error occurred: ";\r\r
-               print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";\r\r
-       }\r\r
-?>\r\r
-<hr/>\r\r
-<em>$Id$</em>\r\r
-</body>\r\r
-</html>\r\r
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
+<head><title>xmlrpc - Which toolkit demo</title></head>
+<body>
+<h1>Which toolkit demo</h1>
+<h2>Query server for toolkit information</h2>
+<h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3>
+<p>You can see the source to this page here: <a href="which.php?showSource=1">which.php</a></p>
+<?php
+
+$req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
+$client = new PhpXmlRpc\Client(XMLRPCSERVER);
+$resp = $client->send($req);
+if (!$resp->faultCode()) {
+    $encoder = new PhpXmlRpc\Encoder();
+    $value = $encoder->decode($resp->value());
+    print "Toolkit info:<br/>\n";
+    print "<pre>";
+    print "name: " . htmlspecialchars($value["toolkitName"]) . "\n";
+    print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n";
+    print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n";
+    print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n";
+    print "</pre>";
+} else {
+    print "An error occurred: ";
+    print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n";
+}
+?>
+</body>
+</html>