Download MetaTrader 5

grabweb

To add comments, please log in or register
Articles have already helped many traders. Come and read them!
jacques366
296
jacques366 2015.02.22 21:35 

Hi, 

This is 2 weeks I am encountering a problem using grabweb for downloading calendar data. In fact, it is running OK (I checked all return coded) but it download the page from 2 weeks ago.

This is a very recent problem as this functionality is running for months with no problem. It's like Grabweb doen't go and fetch the internet page but get an old memorized version of that internet page on the computer. 

Here is the lines of code I am using, here in a script:

//+------------------------------------------------------------------+
//|                                                         GWeb.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//|GRABWEB result display in a message box                               |
//+------------------------------------------------------------------+

#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, string, int, int& OneInt[]);
   int InternetCloseHandle(int); 
   
#import
 
int start()
{
   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;
   }
   
 
   
   if (HttpRequest > 0) InternetCloseHandle(HttpRequest); 
   if (HttpConnect > 0) InternetCloseHandle(HttpConnect); 
   if (HttpOpen > 0) InternetCloseHandle(HttpOpen);  
     MessageBox(NEWS, "HTTP READ:" );     //  i show the result via message box
 
   //----
   return(0);
}
  
//+------------------------------------------------------------------+ 
  
//+------------------------------------------------------------------+

 

 Someone has the clue?

jacques366
296
jacques366 2015.02.23 08:19  

I found the solution: by deleting browsing history in the Internet Explorer. There was an upgrade of IE for security problem the 12th of this month, that may have cause the problem. 

I hope by checking the option 'delete browsing history on exit will solve the problem.

Is there a way of deleting browsing data automatically before using Grabweg ?  

whroeder1
13624
whroeder1 2015.02.23 13:36  

Jacques366:  In fact, it is running OK (I checked all return coded)

int HttpOpen = InternetOpenW(" ", 0, " "," ",0 ); 
int HttpConnect = InternetConnectW(HttpOpen, "", 80, "", "", 3, 0, 1); 
int HttpRequest = InternetOpenUrlW(HttpOpen,URL, NULL, 0, 0, 0);
Where do you check your return codes?  What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
jacques366
296
jacques366 2015.02.25 06:41  

In my program, I just extract those lines to give the only interesting part. I wrote return code instead the values in return. 

Thanks 

/
To add comments, please log in or register