I have found in WebRequest function description:
Server port is automatically selected on the basis of the specified protocol - 80 for "http://" and 443 for "https://".
You can try to use functions InternetOpenUrlW from wininet.dll library. It shouldn't be a problem to find on forum working example.
Ha!
That was it... thank you thank you thank you :))
no problem :)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I"m trying to fetch a local url on my machine (http://localhost:52957). The code below is from the following url (https://www.mql5.com/en/docs/common/webrequest).
I am able to browse to http://localhost:52957 with a web browser.
I keep getting the following error:
5200
ERR_WEBREQUEST_INVALID_ADDRESS
Invalid URL
I have added that url above (the localhost one) to the allowed WebRequest pages.
Any idea how to fix this?
Thanks
Code:
string cookie=NULL,headers;
char post[],result[];int res;
//--- to enable access to the server, you should add URL "https://www.google.com/finance"
//--- in the list of allowed URLs (Main Menu->Tools->Options, tab "Expert Advisors"):
string google_url= "http://localhost:52957"; // "http://www.microsoft.com"; // "http://localhost:52957/"; // "https://www.google.com/finance";
//--- Reset the last error code
ResetLastError();
//--- Loading a html page from Google Finance
int timeout=5000; //--- Timeout below 1000 (1 sec.) is not enough for slow Internet connection
res=WebRequest("GET",google_url,cookie,NULL,timeout,post,0,result,headers);