1. XML-RPC client: state name query
Prev | Chapter 11. Examples | Next

## 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

      $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>";
      }

Prev | Up | Next
Chapter 11. Examples | Home | 2. Executing a multicall call