Download MetaTrader 5

Webrequest problem

To add comments, please log in or register
Baptiste George
528
Baptiste George  

Hi,


Please help to solve problem while "webrequest=200 Too many requests"


This function is too complicated for me. I only can code bots. I can't figure out what's wrong. It was working for years before. Not anymore : (


string GrabWeb()
{
   string cookie=NULL,headers;
   char post[],result[];
   int res;
   ResetLastError();
   res=WebRequest("GET",URL,cookie,NULL,5000,post,0,result,headers);
   if(res==-1)Print(ErrorDescription(GetLastError()));
   printf("WebRequest=%i result=%s",res,CharArrayToString(result));
   return(CharArrayToString(result));
}


I did try this: from https://www.mql5.com/en/forum/171843

But still not working

string GrabWeb()
{
   string cookie=NULL,headers;
   string reqheaders="User-Agent: Mozilla/4.0\r\n";
   char post[],result[];
   int res;
   ResetLastError();
   // res=WebRequest("GET",URL,cookie,NULL,5000,post,0,result,headers);
   int timeout=5000;
   res=WebRequest("GET",URL,reqheaders,timeout,post,result,headers);
   if(res==-1)Print(ErrorDescription(GetLastError()));
   printf("WebRequest=%i result=%s",res,CharArrayToString(result));
   return(CharArrayToString(result));
}



Should I send the entire code?


Thank you in advance.

WebRequest to download ForexFactory News
WebRequest to download ForexFactory News
  • 2017.03.06
  • www.mql5.com
Hi ‌My code to download FF news don't work anymore since this WE ! Anyone using webrequest to download news has this problem...
Carl Schreiber
7354
Carl Schreiber  

What about using

  1. wget and have it started by Windows Task Scheduler?
  2. Write a PowerShell script (started by the Task Scheduler) that uses wget to get the news and the parse the file and save a simple csv-file in the sandbox?

This way you don't have to wait for the first tick, and parsing is a lot easier in PowerShell (its made for this).

whroeder1
16076
whroeder1  
Frenchytrader:

Please help to solve problem while "webrequest=200 Too many requests"

This function is too complicated for me.

I only can code bots.

I can't figure out what's wrong.

It was working for years before. Not anymore : (

  1. You keep trying an impossible thing.
  2.  learn to code it
  3. If you learn #2 or or pay (Freelance) someone to code it.
  4. Use the debugger or print out your variables, including _LastError and find out why.
  5. Your code was broken. The problem has now shown itself.
Baptiste George
528
Baptiste George  
whroeder1:
  1. You keep trying an impossible thing.
  2.  learn to code it
  3. If you learn #2 or or pay (Freelance) someone to code it.
  4. Use the debugger or print out your variables, including _LastError and find out why.
  5. Your code was broken. The problem has now shown itself.

Option 3 was already done. It was working before.

Now it seems to run again nicely, need to check it out tonight.

Also I wonder what means the print message means:

"webrequest=200 Too many requests"


Cheers

Baptiste George
528
Baptiste George  
Carl Schreiber:

What about using

  1. wget and have it started by Windows Task Scheduler?
  2. Write a PowerShell script (started by the Task Scheduler) that uses wget to get the news and the parse the file and save a simple csv-file in the sandbox?

This way you don't have to wait for the first tick, and parsing is a lot easier in PowerShell (its made for this).

Looking interesting.

However I connect to myfxbook and then I get data, so I create global variables into MT4.

To add comments, please log in or register