Refactor the Wrapper class to generate closures by default and avoid usage of 'eval'
[plcapi.git] / demo / client / zopetest.php
1 <html>
2 <head><title>xmlrpc - Zope test demo</title></head>
3 <body>
4 <h1>Zope test demo</h1>
5
6 <h3>The code demonstrates usage of basic authentication to connect to the server</h3>
7 <?php
8
9 include_once __DIR__ . "/../../src/Autoloader.php";
10 PhpXmlRpc\Autoloader::register();
11
12 $req = new PhpXmlRpc\Request('document_src', array());
13 $client = new PhpXmlRpc\Client("pingu.heddley.com:9080/index_html");
14 $client->setCredentials("username", "password");
15 $client->setDebug(2);
16 $resp = $client->send($req);
17 if (!$resp->faultCode()) {
18     $value = $resp->value();
19     print "I received:" . htmlspecialchars($value->scalarval()) . "<br/>";
20     print "<hr/>I got this value back<br/>pre>" .
21         htmlentities($resp->serialize()) . "</pre>\n";
22 } else {
23     print "An error occurred: ";
24     print "Code: " . htmlspecialchars($resp->faultCode())
25         . " Reason: '" . ($resp->faultString()) . "'<br/>";
26 }
27 ?>
28 </body>
29 </html>