bool GetFinancialData(string &Json)
{
bool Ret = false;
string cookie = NULL, headers;
char post[], result[];
string url = "https://api.investing.com/api/financialdata/41064/historical/chart/?interval=PT1M&pointscount=120";
//To enable access to the server, you should add URL "https://api.investing.com"//to the list of allowed URLs (Main Menu->Tools->Options, tab "Expert Advisors"): Allow WebRequest for listed URL://Resetting the last error codeResetLastError();
//Downloading a html page from Investingint res = WebRequest("GET", url, cookie, NULL, 500, post, 0, result, headers);
if (res == -1)
{
Print("Error in WebRequest. Error code = ", GetLastError());
//Perhaps the URL is not listed, display a message about the necessity to add the addressMessageBox("Add the address '" + url + "' to the list of allowed URLs on tab 'Expert Advisors'", "Error", MB_ICONINFORMATION);
}
else
{
if (res == 200)
Json = CharArrayToString(result);
elsePrintFormat("Downloading '%s' failed, error code %d",url,res);
}
return Ret;
}
I also added https://api.investing.com to 'Tools\Options\Expert Advisors\Allow WebRequest for listed URL' but can not get data.
I want to get data from https://api.investing.com/api/financialdata/41064/historical/chart/?interval=PT1M&pointscount=120 using function:
I also added https://api.investing.com to 'Tools\Options\Expert Advisors\Allow WebRequest for listed URL' but can not get data.
Error 403 - "Downloading 'https://api.investing.com/api/financialdata/41064/historical/chart/?interval=PT1M&pointscount=120' failed, error code 403"
With other links I get normal data.
Please guide me to solve this problem.
Thank you!