ultimatepp/reference/XmlRpcCall/main.cpp
cxl 34f28f9e39 .reference
git-svn-id: svn://ultimatepp.org/upp/trunk@13717 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2019-11-24 15:32:40 +00:00

30 lines
653 B
C++

#include <Core/Core.h>
#include <Core/Rpc/Rpc.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.");
}