Is WebRequest function work on Localhost?

 

i test the WebRequest() function on some public domains,such as www.google.com www.mql5.com works very well.

 

but when i use it on LocalHost domians,it doesn't work anymore.

 

i did add localhost domain in the EA tab of option menn. 

 
Try 127.0.0.1
 
deysmacro:
Try 127.0.0.1

doesn't work,any other solutions?

 

thanks for your reply 

 
deysmacro: Try 127.0.0.1
or edit \windows\system32\drivers\etc\hosts and add localhost
xuzhe: doesn't work,any other solutions?
Do you have a web server running on localhost? If you enter localhost into your browser do you get a page?
 
WHRoeder:
xuzhe: doesn't work,any other solutions?
Do you have a web server running on localhost? If you enter localhost into your browser do you get a page?
If there is no page at all, that would be completely different story.
 
xuzhe: it doesn't work anymore.
"Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
deysmacro: that would be completely different story.
No information given, only guesses ventured. How is "no page at all" different from "doesn't work"?
 
xuzhe:

but when i use it on LocalHost domians,it doesn't work anymore.

I can't see a problem using localhost. The following works fine for me:

   char arrPost[], arrResult[];
   string strResponseHeaders;
   int res = WebRequest("GET", "http://localhost/test.htm", NULL, NULL, 10000, arrPost, 0, arrResult, strResponseHeaders);
   Print("Result: ", res, ", error: " , GetLastError());
   Print(CharArrayToString(arrResult));
 
WHRoeder:
deysmacro: Try 127.0.0.1
or edit \windows\system32\drivers\etc\hosts and add localhost
xuzhe: doesn't work,any other solutions?
Do you have a web server running on localhost? If you enter localhost into your browser do you get a page?

Of course i have a web server running,and the browser can get the page on localhost fine.

 

i got the page,but metatrader runtime failed.

 

should i use port 80? 

 

I know the answer now.

 

Only Port 80 and 433 is allowed.

 

i think the document should mentioned this.

Reason: