/ext/php_xmlrpc/client-sample.php

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/ · PHP · 34 lines · 23 code · 8 blank · 3 comment · 2 complexity · a6d3489bccce5ef6faa0d1f3a899cfb8 MD5 · raw file

  1. <html>
  2. <body>
  3. <?php
  4. error_reporting(E_ALL);
  5. ini_set('display_errors', '1');
  6. include 'xmlrpc.inc';
  7. // Make an object to represent our server.
  8. $client = new xmlrpc_client('/~anti/PhpProject1/server.php',
  9. 'localhost', 80);
  10. $client->setdebug(1);
  11. // Send a message to the server.
  12. $message = new xmlrpcmsg('getNewContacts',
  13. array(new xmlrpcval("20010716T18:16:18", 'dateTime.iso8601'),
  14. new xmlrpcval("20010716T18:16:18", 'dateTime.iso8601')));
  15. $result = $client->send($message);
  16. // Process the response.
  17. if (!$result) {
  18. print "<p>Could not connect to HTTP server.</p>";
  19. } elseif ($result->faultCode()) {
  20. print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
  21. $result->faultString();
  22. } else {
  23. print "<p>XML-RPC Response : " .$result-> serialize()."</p>";
  24. }
  25. ?>
  26. </body></html>