2 <head><title>xmlrpc</title></head>
6 /// @todo allow autoloading when the library is installed as dependency
7 include_once __DIR__ . '/../vendor/autoload.php';
9 $req = new PhpXmlRpc\Request('examples.getStateName');
11 print "<h3>Testing value serialization</h3>\n";
13 $v = new PhpXmlRpc\Value(23, "int");
14 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
15 $v = new PhpXmlRpc\Value("What are you saying? >> << &&");
16 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
18 $v = new PhpXmlRpc\Value(
20 new PhpXmlRpc\Value("ABCDEFHIJ"),
21 new PhpXmlRpc\Value(1234, 'int'),
22 new PhpXmlRpc\Value(1, 'boolean'),
27 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
29 $v = new PhpXmlRpc\Value(
31 "thearray" => new PhpXmlRpc\Value(
33 new PhpXmlRpc\Value("ABCDEFHIJ"),
34 new PhpXmlRpc\Value(1234, 'int'),
35 new PhpXmlRpc\Value(1, 'boolean'),
36 new PhpXmlRpc\Value(0, 'boolean'),
37 new PhpXmlRpc\Value(true, 'boolean'),
38 new PhpXmlRpc\Value(false, 'boolean'),
42 "theint" => new PhpXmlRpc\Value(23, 'int'),
43 "thestring" => new PhpXmlRpc\Value("foobarwhizz"),
44 "thestruct" => new PhpXmlRpc\Value(
46 "one" => new PhpXmlRpc\Value(1, 'int'),
47 "two" => new PhpXmlRpc\Value(2, 'int'),
55 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
57 $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array");
59 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
61 $w = new PhpXmlRpc\Value("Mary had a little lamb,
62 Whose fleece was white as snow,
63 And everywhere that Mary went
64 the lamb was sure to go.
66 Mary had a little lamb
67 She tied it to a pylon
68 Ten thousand volts went down its back
69 And turned it into nylon", "base64"
71 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
72 print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
75 $req->addParam(new PhpXmlRpc\Value("41", "int"));
77 print "<h3>Testing request serialization</h3>\n";
78 $op = $req->serialize();
79 print "<PRE>" . htmlentities($op) . "</PRE>";
81 print "<h3>Testing ISO date format</h3><pre>\n";
84 $date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
85 print "Now is $t --> $date\n";
86 print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n";
87 $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
88 print "That is to say $date --> $tb\n";
89 print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n";
90 print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($date, 1) . "\n";