ultimatepp/reference/XmlRpcCall/main.cpp
cxl 452743cdae reference: XmlRpcClient
git-svn-id: svn://ultimatepp.org/upp/trunk@5165 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2012-07-10 12:54:17 +00:00

29 lines
630 B
C++

#include <XmlRpc/XmlRpc.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
LogRpcRequests();
XmlRpcRequest xr("http://foxrate.org/rpc");
xr.Method("foxrate.currencyConvert") << "USD" << "GBP" << 120;
Value v = xr.Execute();
if(v.IsError())
LOG("Error: " << v);
else
if(v["flerror"] == 0)
LOG(v["amount"]);
else
LOG("Failed.");
v = XmlRpcRequest("http://foxrate.org/rpc")("foxrate.currencyConvert", "EUR", "USD", 10)
.Execute();
if(v.IsError())
LOG("Error: " << v);
else
if(v["flerror"] == 0)
LOG(v["amount"]);
else
LOG("Failed.");
}