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(array(
18 new PhpXmlRpc\Value("ABCDEFHIJ"),
19 new PhpXmlRpc\Value(1234, 'int'),
20 new PhpXmlRpc\Value(1, 'boolean'),),
24 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
26 $v = new PhpXmlRpc\Value(
28 "thearray" => new PhpXmlRpc\Value(
30 new PhpXmlRpc\Value("ABCDEFHIJ"),
31 new PhpXmlRpc\Value(1234, 'int'),
32 new PhpXmlRpc\Value(1, 'boolean'),
33 new PhpXmlRpc\Value(0, 'boolean'),
34 new PhpXmlRpc\Value(true, 'boolean'),
35 new PhpXmlRpc\Value(false, 'boolean'),
39 "theint" => new PhpXmlRpc\Value(23, 'int'),
40 "thestring" => new PhpXmlRpc\Value("foobarwhizz"),
41 "thestruct" => new PhpXmlRpc\Value(
43 "one" => new PhpXmlRpc\Value(1, 'int'),
44 "two" => new PhpXmlRpc\Value(2, 'int'),
52 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
54 $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array");
56 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
58 $w = new PhpXmlRpc\Value("Mary had a little lamb,
59 Whose fleece was white as snow,
60 And everywhere that Mary went
61 the lamb was sure to go.
63 Mary had a little lamb
64 She tied it to a pylon
65 Ten thousand volts went down its back
66 And turned it into nylon", "base64"
68 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
69 print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
72 $req->addParam(new PhpXmlRpc\Value("41", "int"));
74 print "<h3>Testing request serialization</h3>\n";
75 $op = $req->serialize();
76 print "<PRE>" . htmlentities($op) . "</PRE>";
78 print "<h3>Testing ISO date format</h3><pre>\n";
81 $date = PhpXmlRpc\Helper\Date::iso8601_encode($t);
82 print "Now is $t --> $date\n";
83 print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601_encode($t, 1) . "\n";
84 $tb = PhpXmlRpc\Helper\Date::iso8601_decode($date);
85 print "That is to say $date --> $tb\n";
86 print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601_encode($tb) . "\n";
87 print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601_decode($date, 1) . "\n";