Doubt in WebRequest()

 

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

 
You cannot invoke some functions from an indicator.
 
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".

...
Reason: