/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * Example for calling XML-RPC web service * */ require_once 'Zend/XmlRpc/Client.php'; require_once 'Zend/Http/Client.php'; try { $http_client = new Zend_Http_Client(); $http_client->setAuth('<USERNAME>','<KEY>'); $client = new Zend_XmlRpc_Client('<URL>'); $client->setHttpClient($http_client); $proxy = $client->getProxy(); $args['arg1'] = '<arg1>'; $args['arg2'] = '<arg2>'; $args['arg3'] = '<arg3>'; $result = $proxy->className->methodName($args); echo $result; } catch (Zend_XmlRpc_Client_FaultException $e) { # display error details echo "<h1>Webservice Error!</h1><br /><br />"; echo "<b>Date/Time:</b> "; echo $today; echo "<br /><br /><b>Error:</b><br /><br />"; echo $e->getMessage(); echo "<br /><br />"; echo "<b>Stack Trace:</b><br /><br />"; echo $e; echo "<br /><br />"; echo "<b>Dump:</b><br /><br />"; } ?>