Download MetaTrader 5
To add comments, please log in or register
Install apps from the library right in MetaTrader. It is easy!
Karthikeyenv Venkadaswamy
97
Karthikeyenv Venkadaswamy 2016.08.16 18:14 

I would like to send user id and password to a website and validate it, and in response I would like to get user account no to validate in the code.

 

string str="Login="+login+"&Password="+password;

   //--- Create the body of the POST request for authorization

   ArrayResize(data,StringToCharArray(str,data,0,WHOLE_ARRAY,CP_UTF8)-1);

//--- Resetting error code

   ResetLastError();

//--- Authorization request

      

   res=WebRequest("POST","http://mywebsite.com","xyz",str,1000,data,ArraySize(data),result,str); 

can anyone let me know where the problem is?  I am getting error 4060

Ovo Cz
2954
Ovo Cz 2016.08.16 19:33  
You cannot invoke some functions from an indicator.
Fernando Carreiro
1428
Fernando Carreiro 2016.08.16 19:57  
vkarthikeyenv: ... can anyone let me know where the problem is?  I am getting error 4060

Before posting, search and read the documentation!

WebRequest
Note
...

The WebRequest() function is synchronous, which means its breaks the program execution and waits for the response from the requested server. Since the delays in receiving a response can be large, the function is not available for calls from the indicators, because indicators run in a common thread shared by all indicators and charts on one symbol. Indicator performance delay on one of the charts of a symbol may stop updating of all charts of the same symbol.

The function can be called only from Expert Advisors and scripts, as they run in their own execution threads. If you try to call the function from an indicator, GetLastError() will return error 4060 — "Function is not allowed for call".

...
/
To add comments, please log in or register