Download MetaTrader 5

WebRequest() login does not work with mql5.com anymore?

To add comments, please log in or register
Georgiy Liashchenko
3336
Georgiy Liashchenko  

Hello everyone,

 I ve been using WebRequest code provided by mt4 support and it was running perfectly, until today...

Server returns 200 which means authorization is ok, but even if i put wrong log/pass it is still 200. And cookie does not creates an auth= field, therefore authorization fails. So basically this code doesn't work anymore or i just don't understand something :( Please help to solve it, or suggest any other website which allow simple authorization. Thanks

 

bool Authorization()
  {
   if(IsTesting())return(true);
string   Login="login";        //Your account
string   Password="password";          //Your account password
   int    res;     // To receive the operation execution result
   char   data[];  // Data array to send POST requests
   string authurl="https://www.mql5.com/en/auth_login";
   string str="Login="+Login+"&Password="+Password;

   ArrayResize(data,StringToCharArray(str,data,0,WHOLE_ARRAY,CP_UTF8)-1);
   ResetLastError();
   res=WebRequest("POST",authurl,NULL,0,data,data,str);
   if(GetLastError()==4060)
     {
      Alert("You have not added ",authurl," to URL permition list in the ( Tools > Options > Expert Advisors tab )");
     }
   if(res!=200)
     {
      Print("Authorization failed!, LastError="+(string)res);
      return(false);
     }
     Print(res);
     Alert(str);
     
   res=StringFind(str,"Set-Cookie: auth=");
   if(res<0)
     {
      Alert("Login/Password failed!");
      return(false);
     }
   else Print("Authorized");

   return(true);
  }
Georgiy Liashchenko
3336
Georgiy Liashchenko  

How to understand that the athorization with another website for example went successful? 

Thats what i get, login/pass are correct 

 

Alain Verleyen
Moderator
32810
Alain Verleyen  
Metaquotes probably changed the login method.
Alain Verleyen
Moderator
32810
Alain Verleyen  

Satyam Shivam:


Why do you need to connect to mql5.com with WebRequest() ?
Satyam Shivam
19993
Satyam Shivam  
Alain Verleyen:
Why do you need to connect to mql5.com with WebRequest() ?


So, that one can upload images directly to the wall using a software which can run automatically all the time. It will load different images at different times.


That is exactly what it does int he sample program provided in the web request explanation page.

https://docs.mql4.com/common/webrequest

WebRequest - Common Functions - MQL4 Reference
WebRequest - Common Functions - MQL4 Reference
  • docs.mql4.com
WebRequest - Common Functions - MQL4 Reference
Alain Verleyen
Moderator
32810
Alain Verleyen  
Satyam Shivam:


So, that one can upload images directly to the wall using a software which can run automatically all the time. It will load different images at different times.


That is exactly what it does int he sample program provided in the web request explanation page.

https://docs.mql4.com/common/webrequest

This is not allowed.

3.7. You agree not to use the website www.mql5.com by any means other than through the interface that is provided by MQL5 Ltd on www.mql5.com or the MetaQuotes Software interface, unless You have been specifically allowed to do so in a separate agreement with MQL5 Ltd. You specifically agree not to access the website www.mql5.com through any automated means, including use of scripts, crawlers, or similar technologies.

Satyam Shivam
19993
Satyam Shivam  
ok, I was really wondering then why those two code examples are still available on mql5.com web sites which are actually published by mql5.com.
To add comments, please log in or register