Created
September 17, 2010 03:26
-
-
Save joet3ch/583612 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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