X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=php%2Fphpxmlrpc%2Fdemo%2Fvardemo.php;fp=php%2Fphpxmlrpc%2Fdemo%2Fvardemo.php;h=3c9812a660924bcb41ae1b7271c19da4f69015b5;hb=21d187714285d9818fd94509b015ba069facb7ef;hp=0000000000000000000000000000000000000000;hpb=9bd41316bc9541bbedfe45377089d4e4927129b1;p=plcapi.git diff --git a/php/phpxmlrpc/demo/vardemo.php b/php/phpxmlrpc/demo/vardemo.php new file mode 100644 index 0000000..3c9812a --- /dev/null +++ b/php/phpxmlrpc/demo/vardemo.php @@ -0,0 +1,95 @@ + +xmlrpc + +Testing value serialization\n"; + +$v = new PhpXmlRpc\Value(23, "int"); +print "
" . htmlentities($v->serialize()) . "
"; +$v = new PhpXmlRpc\Value("What are you saying? >> << &&"); +print "
" . htmlentities($v->serialize()) . "
"; + +$v = new PhpXmlRpc\Value( + array( + new PhpXmlRpc\Value("ABCDEFHIJ"), + new PhpXmlRpc\Value(1234, 'int'), + new PhpXmlRpc\Value(1, 'boolean'), + ), + "array" +); + +print "
" . htmlentities($v->serialize()) . "
"; + +$v = new PhpXmlRpc\Value( + array( + "thearray" => new PhpXmlRpc\Value( + array( + new PhpXmlRpc\Value("ABCDEFHIJ"), + new PhpXmlRpc\Value(1234, 'int'), + new PhpXmlRpc\Value(1, 'boolean'), + new PhpXmlRpc\Value(0, 'boolean'), + new PhpXmlRpc\Value(true, 'boolean'), + new PhpXmlRpc\Value(false, 'boolean'), + ), + "array" + ), + "theint" => new PhpXmlRpc\Value(23, 'int'), + "thestring" => new PhpXmlRpc\Value("foobarwhizz"), + "thestruct" => new PhpXmlRpc\Value( + array( + "one" => new PhpXmlRpc\Value(1, 'int'), + "two" => new PhpXmlRpc\Value(2, 'int'), + ), + "struct" + ), + ), + "struct" +); + +print "
" . htmlentities($v->serialize()) . "
"; + +$w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array"); + +print "
" . htmlentities($w->serialize()) . "
"; + +$w = new PhpXmlRpc\Value("Mary had a little lamb, +Whose fleece was white as snow, +And everywhere that Mary went +the lamb was sure to go. + +Mary had a little lamb +She tied it to a pylon +Ten thousand volts went down its back +And turned it into nylon", "base64" +); +print "
" . htmlentities($w->serialize()) . "
"; +print "
Value of base64 string is: '" . $w->scalarval() . "'
"; + +$req->method(''); +$req->addParam(new PhpXmlRpc\Value("41", "int")); + +print "

Testing request serialization

\n"; +$op = $req->serialize(); +print "
" . htmlentities($op) . "
"; + +print "

Testing ISO date format

\n";
+
+$t = time();
+$date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
+print "Now is $t --> $date\n";
+print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n";
+$tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
+print "That is to say $date --> $tb\n";
+print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n";
+print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($date, 1) . "\n";
+
+print "
\n"; + +?> + +