idHttp Get + Delphi +请求的网址被拒绝

时间:2014-11-27 13:39:07

标签: delphi indy idhttp

我试图运行此代码:

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');
...

我得到了这个:

<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>

任何想法为什么?

1 个答案:

答案 0 :(得分:3)

解决方案,感谢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');
  ...