-<html>\r<head><title>xmlrpc</title></head>\r<body>\r<h1>Agesort demo</h1>\r<h2>Send an array of 'name' => 'age' pairs to the server that will send it back sorted.</h2>\r<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>\r<p></p>\r<?php\rinclude("xmlrpc.inc");\r\r$inAr=array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);\rreset($inAr);\rprint "This is the input data:<br/><pre>";\rwhile (list($key, $val)=each($inAr)) {\r print $key . ", " . $val . "\n";\r}\rprint "</pre>";\r\r// create parameters from the input array: an xmlrpc array of xmlrpc structs\r$p=array();\rforeach($inAr as $key => $val) {\r $p[]=new xmlrpcval(array("name" => new xmlrpcval($key),\r "age" => new xmlrpcval($val, "int")), "struct");\r}\r$v=new xmlrpcval($p, "array");\rprint "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()). "</pre>\n";\r\r// create client and message objects\r$f=new xmlrpcmsg('examples.sortByAge', array($v));\r$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r// set maximum debug level, to have the complete communication printed to screen\r$c->setDebug(2);\r\r// send request\rprint "Now sending request (detailed debug info follows)";\r$r=&$c->send($f);\r\r// check response for errors, and take appropriate action\rif (!$r->faultCode()) {\r print "The server gave me these results:<pre>";\r $v=$r->value();\r $max=$v->arraysize();\r for($i=0; $i<$max; $i++) {\r $rec=$v->arraymem($i);\r $n=$rec->structmem("name");\r $a=$rec->structmem("age");\r print htmlspecialchars($n->scalarval()) . ", " . htmlspecialchars($a->scalarval()) . "\n";\r }\r\r print "<hr/>For nerds: I got this value back<br/><pre>" .\r htmlentities($r->serialize()). "</pre><hr/>\n";\r} else {\r print "An error occurred:<pre>";\r print "Code: " . htmlspecialchars($r->faultCode()) .\r "\nReason: '" . htmlspecialchars($r->faultString()).'\'</pre><hr/>';\r}\r\r?>\r<em>$Id$</em>\r</body>\r</html>\r
\ No newline at end of file
+<html>\r<head><title>xmlrpc</title></head>\r<body>\r<h1>Agesort demo</h1>\r<h2>Send an array of 'name' => 'age' pairs to the server that will send it back sorted.</h2>\r<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>\r<p></p>\r<?php\rinclude("xmlrpc.inc");\r\r$inAr=array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);\rreset($inAr);\rprint "This is the input data:<br/><pre>";\rwhile (list($key, $val)=each($inAr)) {\r print $key . ", " . $val . "\n";\r}\rprint "</pre>";\r\r// create parameters from the input array: an xmlrpc array of xmlrpc structs\r$p=array();\rforeach($inAr as $key => $val) {\r $p[]=new xmlrpcval(array("name" => new xmlrpcval($key),\r "age" => new xmlrpcval($val, "int")), "struct");\r}\r$v=new xmlrpcval($p, "array");\rprint "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()). "</pre>\n";\r\r// create client and message objects\r$f=new xmlrpcmsg('examples.sortByAge', array($v));\r$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r// set maximum debug level, to have the complete communication printed to screen\r$c->setDebug(2);\r\r// send request\rprint "Now sending request (detailed debug info follows)";\r$r=&$c->send($f);\r\r// check response for errors, and take appropriate action\rif (!$r->faultCode()) {\r print "The server gave me these results:<pre>";\r $v=$r->value();\r $max=$v->arraysize();\r for($i=0; $i<$max; $i++) {\r $rec=$v->arraymem($i);\r $n=$rec->structmem("name");\r $a=$rec->structmem("age");\r print htmlspecialchars($n->scalarval()) . ", " . htmlspecialchars($a->scalarval()) . "\n";\r }\r\r print "<hr/>For nerds: I got this value back<br/><pre>" .\r htmlentities($r->serialize()). "</pre><hr/>\n";\r} else {\r print "An error occurred:<pre>";\r print "Code: " . htmlspecialchars($r->faultCode()) .\r "\nReason: '" . htmlspecialchars($r->faultString()).'\'</pre><hr/>';\r}\r\r?>\r</body>\r</html>\r
\ No newline at end of file
-<html>\r\r
-<head><title>xmlrpc</title></head>\r\r
-<body>\r\r
-<h1>Introspect demo</h1>\r\r
-<h2>Query server for available methods and their description</h2>\r\r
-<h3>The code demonstrates usage of multicall and introspection methods</h3>\r\r
-<?php\r\r
- include("xmlrpc.inc");\r\r
-\r\r
- function display_error($r)\r\r
- {\r\r
- print "An error occurred: ";\r\r
- print "Code: " . $r->faultCode()\r\r
- . " Reason: '" .$r->faultString()."'<br/>";\r\r
- }\r\r
-\r\r
- // 'new style' client constuctor\r\r
- $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");\r\r
- print "<h3>methods available at http://" . $c->server . $c->path . "</h3>\n";\r\r
-\r\r
- $m = new xmlrpcmsg('system.listMethods');\r\r
- $r =& $c->send($m);\r\r
- if($r->faultCode())\r\r
- {\r\r
- display_error($r);\r\r
- }\r\r
- else\r\r
- {\r\r
- $v=$r->value();\r\r
- for($i=0; $i<$v->arraysize(); $i++)\r\r
- {\r\r
- $mname=$v->arraymem($i);\r\r
- print "<h4>" . $mname->scalarval() . "</h4>\n";\r\r
-\r\r
- // build messages first, add params later\r\r
- $m1 = new xmlrpcmsg('system.methodHelp');\r\r
- $m2 = new xmlrpcmsg('system.methodSignature');\r\r
- $val = new xmlrpcval($mname->scalarval(), "string");\r\r
- $m1->addParam($val);\r\r
- $m2->addParam($val);\r\r
-\r\r
- // send multiple messages in one pass.\r\r
- // If server does not support multicall, client will fall back to 2 separate calls\r\r
- $ms = array($m1, $m2);\r\r
- $rs =& $c->send($ms);\r\r
-\r\r
- if($rs[0]->faultCode())\r\r
- {\r\r
- display_error($rs[0]);\r\r
- }\r\r
- else\r\r
- {\r\r
- $val=$rs[0]->value();\r\r
- $txt=$val->scalarval();\r\r
- if($txt != "")\r\r
- {\r\r
- print "<h4>Documentation</h4><p>${txt}</p>\n";\r\r
- }\r\r
- else\r\r
- {\r\r
- print "<p>No documentation available.</p>\n";\r\r
- }\r\r
- }\r\r
-\r\r
- if($rs[1]->faultCode())\r\r
- {\r\r
- display_error($rs[1]);\r\r
- }\r\r
- else\r\r
- {\r\r
- print "<h4>Signature</h4><p>\n";\r\r
- $val = $rs[1]->value();\r\r
- if($val->kindOf()=="array")\r\r
- {\r\r
- for($j=0; $j<$val->arraysize(); $j++)\r\r
- {\r\r
- $x = $val->arraymem($j);\r\r
- $ret = $x->arraymem(0);\r\r
- print "<code>" . $ret->scalarval() . " "\r\r
- . $mname->scalarval() . "(";\r\r
- if($x->arraysize()>1)\r\r
- {\r\r
- for($k=1; $k<$x->arraysize(); $k++)\r\r
- {\r\r
- $y = $x->arraymem($k);\r\r
- print $y->scalarval();\r\r
- if($k < $x->arraysize()-1)\r\r
- {\r\r
- print ", ";\r\r
- }\r\r
- }\r\r
- }\r\r
- print ")</code><br/>\n";\r\r
- }\r\r
- }\r\r
- else\r\r
- {\r\r
- print "Signature unknown\n";\r\r
- }\r\r
- print "</p>\n";\r\r
- }\r\r
- }\r\r
- }\r\r
-?>\r\r
-<hr/>\r\r
-<em>$Id$</em>\r\r
-</body>\r\r
-</html>\r\r
+<html>\r\r<head><title>xmlrpc</title></head>\r\r<body>\r\r<h1>Introspect demo</h1>\r\r<h2>Query server for available methods and their description</h2>\r\r<h3>The code demonstrates usage of multicall and introspection methods</h3>\r\r<?php\r\r include("xmlrpc.inc");\r\r\r\r function display_error($r)\r\r {\r\r print "An error occurred: ";\r\r print "Code: " . $r->faultCode()\r\r . " Reason: '" .$r->faultString()."'<br/>";\r\r }\r\r\r\r // 'new style' client constuctor\r\r $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");\r\r print "<h3>methods available at http://" . $c->server . $c->path . "</h3>\n";\r\r\r\r $m = new xmlrpcmsg('system.listMethods');\r\r $r =& $c->send($m);\r\r if($r->faultCode())\r\r {\r\r display_error($r);\r\r }\r\r else\r\r {\r\r $v=$r->value();\r\r for($i=0; $i<$v->arraysize(); $i++)\r\r {\r\r $mname=$v->arraymem($i);\r\r print "<h4>" . $mname->scalarval() . "</h4>\n";\r\r\r\r // build messages first, add params later\r\r $m1 = new xmlrpcmsg('system.methodHelp');\r\r $m2 = new xmlrpcmsg('system.methodSignature');\r\r $val = new xmlrpcval($mname->scalarval(), "string");\r\r $m1->addParam($val);\r\r $m2->addParam($val);\r\r\r\r // send multiple messages in one pass.\r\r // If server does not support multicall, client will fall back to 2 separate calls\r\r $ms = array($m1, $m2);\r\r $rs =& $c->send($ms);\r\r\r\r if($rs[0]->faultCode())\r\r {\r\r display_error($rs[0]);\r\r }\r\r else\r\r {\r\r $val=$rs[0]->value();\r\r $txt=$val->scalarval();\r\r if($txt != "")\r\r {\r\r print "<h4>Documentation</h4><p>${txt}</p>\n";\r\r }\r\r else\r\r {\r\r print "<p>No documentation available.</p>\n";\r\r }\r\r }\r\r\r\r if($rs[1]->faultCode())\r\r {\r\r display_error($rs[1]);\r\r }\r\r else\r\r {\r\r print "<h4>Signature</h4><p>\n";\r\r $val = $rs[1]->value();\r\r if($val->kindOf()=="array")\r\r {\r\r for($j=0; $j<$val->arraysize(); $j++)\r\r {\r\r $x = $val->arraymem($j);\r\r $ret = $x->arraymem(0);\r\r print "<code>" . $ret->scalarval() . " "\r\r . $mname->scalarval() . "(";\r\r if($x->arraysize()>1)\r\r {\r\r for($k=1; $k<$x->arraysize(); $k++)\r\r {\r\r $y = $x->arraymem($k);\r\r print $y->scalarval();\r\r if($k < $x->arraysize()-1)\r\r {\r\r print ", ";\r\r }\r\r }\r\r }\r\r print ")</code><br/>\n";\r\r }\r\r }\r\r else\r\r {\r\r print "Signature unknown\n";\r\r }\r\r print "</p>\n";\r\r }\r\r }\r\r }\r\r?>\r\r</body>\r\r</html>\r\r
\ No newline at end of file
-<html>\r\r
-<head><title>xmlrpc</title></head>\r\r
-<body>\r\r
-<h1>Which toolkit demo</h1>\r\r
-<h2>Query server for toolkit information</h2>\r\r
-<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>\r\r
-<?php\r\r
- include("xmlrpc.inc");\r\r
-\r\r
- $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());\r\r
- $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r
- $r = $c->send($f);\r\r
- if(!$r->faultCode())\r\r
- {\r\r
- $v = php_xmlrpc_decode($r->value());\r\r
- print "<pre>";\r\r
- print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";\r\r
- print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";\r\r
- print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";\r\r
- print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";\r\r
- print "</pre>";\r\r
- }\r\r
- else\r\r
- {\r\r
- print "An error occurred: ";\r\r
- print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";\r\r
- }\r\r
-?>\r\r
-<hr/>\r\r
-<em>$Id$</em>\r\r
-</body>\r\r
-</html>\r\r
+<html>\r\r<head><title>xmlrpc</title></head>\r\r<body>\r\r<h1>Which toolkit demo</h1>\r\r<h2>Query server for toolkit information</h2>\r\r<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>\r\r<?php\r\r include("xmlrpc.inc");\r\r\r\r $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());\r\r $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r $r = $c->send($f);\r\r if(!$r->faultCode())\r\r {\r\r $v = php_xmlrpc_decode($r->value());\r\r print "<pre>";\r\r print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";\r\r print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";\r\r print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";\r\r print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";\r\r print "</pre>";\r\r }\r\r else\r\r {\r\r print "An error occurred: ";\r\r print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";\r\r }\r\r?>\r\r</body>\r\r</html>\r\r
\ No newline at end of file