我正在做一个工匠命令,在这个网页上获取json:https://www.arera.it/it/atti-18.json
我正在使用php / guzzle库:
$client = new \GuzzleHttp\Client();
$crawler = $client->request('GET', 'https://www.arera.it/it/atti-18.json');
echo $res->getBody();
但我在输出控制台中收到此信息:
<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: 5887289226846801693</body></html>
而不是json . 有人可以帮帮我吗?我正在使用laravel 5.4和最新版本的guzzle .
2 回答
好的,我已经解决了我的问题 . 在我的客户端请求中,我添加了头文件数组,如guzzle文档http://docs.guzzlephp.org/en/stable/request-options.html#headers . 所以我的客户请求是:
也许它可以帮助其他民族 . 谢谢你的回复 .
这样的消息可以由保护服务器免受滥用的过滤器生成 . 此类禁令通常会在一天后到期,因此您可以稍后再试 .