Getstatename demo

Send a U.S. state number to the server and get back the state name

The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values

encode($stateNo)) ); print "Sending the following request:
\n\n" . htmlentities($req->serialize()) . "\n\n
Debug info of server data follows...\n\n"; $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); $client->setDebug(1); $r = $client->send($req); if (!$r->faultCode()) { $v = $r->value(); print "
State number " . $stateNo . " is " . htmlspecialchars($encoder->decode($v)) . "
"; } else { print "An error occurred: "; print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'
"; } } else { $stateNo = ""; } print "

Enter a state number to query its name

"; ?>