Appendix A. Integration with the PHP xmlrpc extension

To be documented more...

In short: for the fastest execution possible, you can enable the php native xmlrpc extension, and use it in conjunction with phpxmlrpc. The following code snippet gives an example of such integration

/*** client side ***/
$c = new xmlrpc_client('');
// tell the client to return raw xml as response value
$c->return_type = 'xml';
// let's the native xmlrpc extension take care of encoding request parameters
$r = $c->send(xmlrpc_encode_request('examples.getStateName', $_POST['stateno']));
if (!$r->faultCode()) {
  // HTTP request OK, but XML returned from server not parsed yet
  $v = xmlrpc_decode($r->value());
  // check if server sent an error response
  if (is_array($v) && array_key_exists('faultCode'))
    echo 'Got error '.$v['faultCode'];
    echo'Got response: '.htmlentities($v);
} else {
  // HTTP transport error
  echo 'Got error '.$r->faultCode();