Skip to content

Instantly share code, notes, and snippets.

@joet3ch
Created September 17, 2010 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joet3ch/583612 to your computer and use it in GitHub Desktop.
Save joet3ch/583612 to your computer and use it in GitHub Desktop.
<?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> ";
$today = date("D M j G:i:s T Y");
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 />";
print_r($e);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment