Return to Snippet

Revision: 22264
at January 7, 2010 10:09 by joet3ch


Initial Code
<?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);
}

?>

Initial URL

                                

Initial Description

                                

Initial Title
Zend XML-RPC Client

Initial Tags
php

Initial Language
PHP