2 <head><title>xmlrpc</title></head>
6 include_once __DIR__ . "/../vendor/autoload.php";
8 $req = new PhpXmlRpc\Request('examples.getStateName');
10 print "<h3>Testing value serialization</h3>\n";
12 $v = new PhpXmlRpc\Value(23, "int");
13 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
14 $v = new PhpXmlRpc\Value("What are you saying? >> << &&");
15 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
17 $v = new PhpXmlRpc\Value(
19 new PhpXmlRpc\Value("ABCDEFHIJ"),
20 new PhpXmlRpc\Value(1234, 'int'),
21 new PhpXmlRpc\Value(1, 'boolean'),
26 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
28 $v = new PhpXmlRpc\Value(
30 "thearray" => new PhpXmlRpc\Value(
32 new PhpXmlRpc\Value("ABCDEFHIJ"),
33 new PhpXmlRpc\Value(1234, 'int'),
34 new PhpXmlRpc\Value(1, 'boolean'),
35 new PhpXmlRpc\Value(0, 'boolean'),
36 new PhpXmlRpc\Value(true, 'boolean'),
37 new PhpXmlRpc\Value(false, 'boolean'),
41 "theint" => new PhpXmlRpc\Value(23, 'int'),
42 "thestring" => new PhpXmlRpc\Value("foobarwhizz"),
43 "thestruct" => new PhpXmlRpc\Value(
45 "one" => new PhpXmlRpc\Value(1, 'int'),
46 "two" => new PhpXmlRpc\Value(2, 'int'),
54 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
56 $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array");
58 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
60 $w = new PhpXmlRpc\Value("Mary had a little lamb,
61 Whose fleece was white as snow,
62 And everywhere that Mary went
63 the lamb was sure to go.
65 Mary had a little lamb
66 She tied it to a pylon
67 Ten thousand volts went down its back
68 And turned it into nylon", "base64"
70 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
71 print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
74 $req->addParam(new PhpXmlRpc\Value("41", "int"));
76 print "<h3>Testing request serialization</h3>\n";
77 $op = $req->serialize();
78 print "<PRE>" . htmlentities($op) . "</PRE>";
80 print "<h3>Testing ISO date format</h3><pre>\n";
83 $date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
84 print "Now is $t --> $date\n";
85 print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n";
86 $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
87 print "That is to say $date --> $tb\n";
88 print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n";
89 print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($date, 1) . "\n";