我正在尝试运行以下代码:
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>
知道为什么吗?
最佳答案
解决方案,感谢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');
...
关于delphi - idHttp Get + Delphi +所请求的URL被拒绝,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27172043/