when i change it to local host address,it always return 4002
int SyncOrder(string strSymbol,string Operate) { string cookie=NULL,headers; char post[],result[]; int res; string url="http://localhost:8765"; Print("Sending request to "+ url); ResetLastError(); res=WebRequest("GET",url,cookie,NULL,50,post,0,result,headers); if(res==-1) { Print("Error code =",GetLastError()); //--- maybe the URL is not added, show message to add it MessageBox("Add address '"+url+"' in Expert Advisors tab of the Options window","Error",MB_ICONINFORMATION); return(-1); } else { //--- successful PrintFormat("Download successful, size =%d bytes.",ArraySize(result)); //--- save data to file //string strResult = CharArrayToString(result,0,ArraySize(result),CP_UTF8); return(1); } return(1); }
i add address to the allow list:
and the address is OK
Try 127.0.0.1
Maybe that localhost cannot be resolved.
Try 127.0.0.1
Maybe that localhost cannot be resolved.
127.0.0.1
same result.
Hi there,
I have the same problem. I receive 4002 but not only when connecting to localhost but also to my server on the internet. I have added the URLs to the trusted sites.
Anybody managed to fix the problem?
Full domain names is allowed and only 80/433 ports.
If you want to connect to localhost, use domain like my.domain.com and setup address in hosts file.
thanks,you are right,port 80 works fine.
it should be written in document.
Hi,
I have added the URL (http://localhost:433/) in the Expert Advisor but EA still tells me to add it?
See attached pic.
Hi,
I have added the URL (http://localhost:433/) in the Expert Advisor but EA still tells me to add it?
See attached pic.
Contact the author/seller of the EA for support.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
with the page https://www.mql5.com/en/docs/common/webrequest
i tried with my own script,the function works very well when i send request to public servers.
with the same code,when i send request to url like http://127.0.0.1:8765/,it always return 4002 error code.