Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi idHttp-Get+;德尔福+;请求的URL被拒绝_Delphi_Indy_Idhttp - Fatal编程技术网

Delphi idHttp-Get+;德尔福+;请求的URL被拒绝

Delphi idHttp-Get+;德尔福+;请求的URL被拒绝,delphi,indy,idhttp,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'); ... 我明白了: 请求被拒绝 请求的URL被拒绝。请咨询管理员。您的

我正在尝试运行以下代码:

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');
...
我明白了:


请求被拒绝
请求的URL被拒绝。请咨询管理员。
您的支持ID是:109088803187671168

知道原因吗?

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

objHttp.Request.UserAgent
设置为某个web浏览器用户代理。该服务器不喜欢Indy的默认服务器。谢谢,这解决了问题!