Table of Contents
The best examples are to be found in the sample files included with the distribution. Some are included here.
Code to get the corresponding state name from a number (1-50) from the demo server available on SourceForge
$m = new xmlrpcmsg('examples.getStateName',
array(new xmlrpcval($HTTP_POST_VARS["stateno"], "int")));
$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
$r = $c->send($m);
if (!$r->faultCode()) {
$v = $r->value();
print "State number " . htmlentities($HTTP_POST_VARS["stateno"]) . " is " .
htmlentities($v->scalarval()) . "<BR>";
print "<HR>I got this value back<BR><PRE>" .
htmlentities($r->serialize()) . "</PRE><HR>\n";
} else {
print "Fault <BR>";
print "Code: " . htmlentities($r->faultCode()) . "<BR>" .
"Reason: '" . htmlentities($r->faultString()) . "'<BR>";
}