Getstatename demo
Send a U.S. state number to the server and get back the state name
The code demonstrates usage of the php_xmlrpc_encode function
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($v->scalarval()) . "
";
// print "
I got this value back
" .
// htmlentities($r->serialize()). "
\n";
} 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
";
?>