2 <head><title>xmlrpc</title></head>
4 <h1>Getstatename demo</h1>
5 <h2>Send a U.S. state number to the server and get back the state name</h2>
6 <h3>The code demonstrates usage of the php_xmlrpc_encode function</h3>
10 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
11 if(!isset($HTTP_POST_VARS) && isset($_POST))
13 $HTTP_POST_VARS = $_POST;
16 if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
18 $stateno=(integer)$HTTP_POST_VARS["stateno"];
19 $f=new xmlrpcmsg('examples.getStateName',
20 array(php_xmlrpc_encode($stateno))
22 print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
23 $c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
29 print "</pre><br/>State number " . $stateno . " is "
30 . htmlspecialchars($v->scalarval()) . "<br/>";
31 // print "<HR>I got this value back<BR><PRE>" .
32 // htmlentities($r->serialize()). "</PRE><HR>\n";
36 print "An error occurred: ";
37 print "Code: " . htmlspecialchars($r->faultCode())
38 . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
46 print "<form action=\"client.php\" method=\"POST\">
47 <input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
48 <p>Enter a state number to query its name</p>";