2

I'm trying to run this code:

var
  objHttp: TIdHTTP;
...
  objHttp.HandleRedirects := True;
  objHttp.AllowCookies := True;
  sGet := objHttp.Get('http://www.bmf.com.br/arquivos1/arquivos_ipn.asp?idioma=pt-BR&status=ativo');
...

and I'm getting this:

<code>
   <html>
      <head>
         <title>Request Rejected</title>
      </head>
      <body>The requested URL was rejected. Please consult with your administrator.<br>Your support ID is: 109088803187671168</body>
   </html>
</code>

any idea why?

TLama
  • 75,147
  • 17
  • 214
  • 392
GPGomes
  • 147
  • 3
  • 14
  • 3
    Set `objHttp.Request.UserAgent` to some web browser user agent. That server does not like the Indy's default one. – TLama Nov 27 '14 at 13:42

1 Answers1

3

Solution, thanks to TLama:

var
  objHttp: TIdHTTP;
  ...
  objHttp.HandleRedirects := True;
  objHttp.AllowCookies := True;
  objHttp.Request.UserAgent := 'Mozilla/5.0';
  sGet := objHttp.Get('http://www.bmf.com.br/arquivos1/arquivos_ipn.asp?idioma=pt-BR&status=ativo');
  ...
GPGomes
  • 147
  • 3
  • 14