2 <head><title>xmlrpc</title></head>
5 include_once __DIR__ . "/../vendor/autoload.php";
7 include_once __DIR__ . "/../lib/xmlrpc.inc";
9 $f = 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(array(
19 new PhpXmlRpc\Value("ABCDEFHIJ"),
20 new PhpXmlRpc\Value(1234, 'int'),
21 new PhpXmlRpc\Value(1, 'boolean'),),
25 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
27 $v = new PhpXmlRpc\Value(
29 "thearray" => new PhpXmlRpc\Value(
31 new PhpXmlRpc\Value("ABCDEFHIJ"),
32 new PhpXmlRpc\Value(1234, 'int'),
33 new PhpXmlRpc\Value(1, 'boolean'),
34 new PhpXmlRpc\Value(0, 'boolean'),
35 new PhpXmlRpc\Value(true, 'boolean'),
36 new PhpXmlRpc\Value(false, 'boolean'),
40 "theint" => new PhpXmlRpc\Value(23, 'int'),
41 "thestring" => new PhpXmlRpc\Value("foobarwhizz"),
42 "thestruct" => new PhpXmlRpc\Value(
44 "one" => new PhpXmlRpc\Value(1, 'int'),
45 "two" => new PhpXmlRpc\Value(2, 'int'),
53 print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
55 $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array");
57 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
59 $w = new PhpXmlRpc\Value("Mary had a little lamb,
60 Whose fleece was white as snow,
61 And everywhere that Mary went
62 the lamb was sure to go.
64 Mary had a little lamb
65 She tied it to a pylon
66 Ten thousand volts went down its back
67 And turned it into nylon", "base64"
69 print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
70 print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
73 $f->addParam(new PhpXmlRpc\Value("41", "int"));
75 print "<h3>Testing request serialization</h3>\n";
76 $op = $f->serialize();
77 print "<PRE>" . htmlentities($op) . "</PRE>";
79 print "<h3>Testing ISO date format</h3><pre>\n";
82 $date = iso8601_encode($t);
83 print "Now is $t --> $date\n";
84 print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n";
85 $tb = iso8601_decode($date);
86 print "That is to say $date --> $tb\n";
87 print "Which comes out at " . iso8601_encode($tb) . "\n";
88 print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n";