Just looking at it quickly but it looks like your function pops up the MessageBox for you so you don't need to call it from INSIDE a MessageBox in the Ontimer() function.. looks like a simple
geturl("http://www.mydummywebsite.com/test.txt");
Might work.
But like I said I didn't really study it... good luck.
PipPip..jimdandy
Hi Jimdandy
Thanks for the reply. I tried the MessageBox inside both functions for some sort of 'debugging', to be sure it wasn't going wrong with the function return. But both MessageBoxes pop up blank in my second example.
The original URL was replaced, I thought "mydummywebsite.com" would make that clear.
I'll change the post with a working URL, like for example: http://www.forexfactory.com/ff_calendar_thisweek.xml
#define READURL_BUFFER_SIZE 100 #import "Wininet.dll" int InternetOpenW(string, int, string, string, int); int InternetConnectW(int, string, int, string, string, int, int, int); int HttpOpenRequestW(int, string, string, int, string, int, string, int); int InternetOpenUrlW(int, string, string, int, int, int); int InternetReadFile(int, uchar & arr[], int, int& OneInt[]); int InternetCloseHandle(int); #import geturl("http://www.forexfactory.com/ff_calendar_thisweek.xml"); string geturl(string url) { int HttpOpen = InternetOpenW(" ", 0, " ", " ", 0); int HttpConnect = InternetConnectW(HttpOpen, "", 80, "", "", 3, 0, 1); int HttpRequest = InternetOpenUrlW(HttpOpen, url, NULL, 0, 0, 0); int read[1]; uchar Buffer[]; ArrayResize(Buffer, READURL_BUFFER_SIZE + 1); string page = ""; while (true) { InternetReadFile(HttpRequest, Buffer, READURL_BUFFER_SIZE, read); string strThisRead = CharArrayToString(Buffer, 0, read[0], CP_UTF8); if (read[0] > 0) page = page + strThisRead; else break; } if (HttpRequest > 0) InternetCloseHandle(HttpRequest); if (HttpConnect > 0) InternetCloseHandle(HttpConnect); if (HttpOpen > 0) InternetCloseHandle(HttpOpen); MessageBox(page, "HTTP READ:" ); return page; }
Hi ,
I have tried the following code: To call an https: web page into an EA or indicator, but unable to get it to load. I have tried the but unable to get it to work.
can anyone assist thanks
Ideas?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I tried to search for a similar problem, but couldn't find it.
I use a snippet to read an URL from MetaTrader, found here: https://forum.mql4.com/60608/page2 This works when I put the code in the OnTimer (or OnInit) function, but not when I put it in a own function which I call from the OnTimer function.
This works and shows the value of the text file on my server:
This doesn't work:
The messagebox inside the geturl function is blank, same as the messagebox in the timer function. The URL given in the Timer function is correct when I print it in the geturl function. So something goes wrong on the call to the website itself, but I can't figure out what. Any ideas?
Edit: 20140226: replaced "mydummywebsite.com" with "http://www.forexfactory.com/ff_calendar_thisweek.xml"