1. XML-RPC client: state name query

Code to get the corresponding state name from a number (1-50) from the demo server available on Sourceforge

  $f=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($f);
  $v=$r->value();
  if (!$r->faultCode()) {
      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>";
  }