<?php
require_once('lib/xmlrpc.inc');
//initialize client
$xmlrpc_client=new xmlrpc_client('/rpc','www.foxrate.org',80);
$xmlrpc_client->setDebug(3);//turn on debugging mode
//construct the request (xml-rpc message)
$xmlrpc_msg=new xmlrpcmsg('foxrate.currencyConvert', array(new xmlrpcval('USD','string'), new xmlrpcval('EUR','string'), new xmlrpcval(1,'double')));
//send the request
$xmlrpc_resp=$xmlrpc_client->send($xmlrpc_msg);
//working with the server's response
if (!$xmlrpc_resp)
{
print "<p>Could not connect to HTTP server.</p>";
}
elseif ($xmlrpc_resp->faultCode())
{
print "<p>XML-RPC Fault #" . $xmlrpc_resp->faultCode() . ": " .$xmlrpc_resp->faultString();
}
else
{
$result = $xmlrpc_resp->value();
$amount = $result->structmem('amount');
echo "<br><br>Amount Converted: ".$amount->scalarval();
}
?>
Tags:
© 2010 Created by Shakeel Shrestha on Ning. Create a Ning Network!
You need to be a member of HoHalla to add comments!
Join this Ning Network