/ext/php_xmlrpc/client-sample.php
PHP | 34 lines | 23 code | 8 blank | 3 comment | 2 complexity | a6d3489bccce5ef6faa0d1f3a899cfb8 MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
- <html>
- <body>
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', '1');
- include 'xmlrpc.inc';
- // Make an object to represent our server.
- $client = new xmlrpc_client('/~anti/PhpProject1/server.php',
- 'localhost', 80);
- $client->setdebug(1);
- // Send a message to the server.
- $message = new xmlrpcmsg('getNewContacts',
- array(new xmlrpcval("20010716T18:16:18", 'dateTime.iso8601'),
- new xmlrpcval("20010716T18:16:18", 'dateTime.iso8601')));
- $result = $client->send($message);
- // Process the response.
- if (!$result) {
- print "<p>Could not connect to HTTP server.</p>";
- } elseif ($result->faultCode()) {
- print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
- $result->faultString();
- } else {
- print "<p>XML-RPC Response : " .$result-> serialize()."</p>";
- }
- ?>
- </body></html>