Internet access / GrabWeb issue

 

Hello,

I have noticed that when I recompile the GrabWeb function using the MT4 Version: 4.0 Build 625 (21 Mar 2014) the InternetReadFile() does not return anything but a space (1 character long) for every reading instead of the correct strings.

If, on the same platform as above mentioned, I run the same program using an old load module (.ex4) issued from a compilation realized a few weeks ago it runs OK. So I tend to think there has been something changed between b 620 and b 625 that produces this annoyance. That can be in the compilation process itself, in a module linked during that process or a module called during execution time of the InternetReadFile() or InternetConnectW() maybe... or somewhere I am not able to imagine.

I run the platform provided by different brokers as well as the one downloaded from MetaQuotes to see if the issue was persistent. I also run them in different Windows.

(I having the same issue using WinInet)

1 - Am I the only one to get this issue? (before testing a recompilation save your load module)

2 - Please where can I find the information I need to correct my code ?

3 - Is there a way to block upgrade of the platform without being asked ? Maybe a file to protect from being overwritten or a way to trap the version in a program (like the account information, if the DLL calls are allowed (I would like to make some tests before using a new version in order to ensure the permanence of my own programs)

I am joining the GrabWeb function that I am using in case it appears obvious for some of you that this comes from the code:

bool GrabWeb(string strUrl, string& strWebPage)
   {// taken from the script GRABWEB
   
    string URL="http://www.forexfactory.com/ff_calendar_thisweek.xml";
  
    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];
    string Buffer = " ";
    string NEWS = "";
    while (true)
      {
       InternetReadFile(HttpRequest, Buffer, StringLen(Buffer), read);
       if (read[0] > 0) 
          {NEWS = NEWS + StringSubstr(Buffer, 0, read[0]);
          }
       else             
          break;
      }
   
    strWebPage = NEWS;
 
    if (HttpRequest > 0) InternetCloseHandle(HttpRequest); 
    if (HttpConnect > 0) InternetCloseHandle(HttpConnect); 
    if (HttpOpen > 0) 
       int bSuccess = InternetCloseHandle(HttpOpen); 
   
    return(bSuccess);
   
   }  

Thank you in advance for your help.

Regards

 

Thanks a lot qjol, it's fixed now.

And I have found the answer concerning the point 3 : TerminalInfoInteger(TERMINAL_BUILD);

 
Jacques366:

Thanks a lot qjol, it's fixed now.

Have you an idea about the point 3 ?


if file doesn't exist download file set globalvariable lastupdatetime

if file exist check lastupdatetime for checking if you want to download it again

Reason: