webrequest works with mql5 but not on mql4

 

Hi, recently made a EA with MQL5 iam now recoding it for mql4.

Function returns a simple JWT token.

I have updated the "WebRequest for listed url" with the url on both.

Any ideas? Thanks.

CJAVal Login(CJAVal &dataobj) {
   CJAVal json;
   string url="http://127.0.0.1:5000/loginExtension";

   char data[]; 
   ArrayResize(data, StringToCharArray(dataobj.Serialize(), data, 0, WHOLE_ARRAY)-1);

   char res_data[];
   string res_headers=NULL;
   WebRequest("POST", url, "Content-Type: text/plain\r\n", 5000, data, res_data, res_headers);
   
   Print(CharArrayToString(res_data));
   
   json.Deserialize(CharArrayToString(res_data));
   
   return json;
}
 
Nemesis Turtle:

Hi, recently made a EA with MQL5 iam now recoding it for mql4.

Function returns a simple JWT token.

I have updated the "WebRequest for listed url" with the url on both.

Any ideas? Thanks.


Figured it out. You cant use localhost with mql4 which is annoying.