file_get_contents 早些时候工作时失败
file_get_contents failing when was working earlier
我正在尝试访问 Steam 提供的多个 json 文件,以获取 CSGO 物品的市场价格。我使用的第一个 file_get_contents 有效:
$inventory = file_get_contents('http://steamcommunity.com/profiles/' . $steamprofile['steamid'] . '/inventory/json/730/2');
但是第二个开始不起作用:
$marketString = file_get_contents('http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=' . urlencode($json_a->{'rgDescriptions'}->$rgDescrId->{'market_hash_name'}));
但是我在所有项目上都遇到了错误,例如:
Warning: file_get_contents(http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Negev%20|%20Nuclear%20Waste%20(Minimal%20Wear)): failed to open stream: HTTP request failed! HTTP/1.0 429 Unknown in /home4/matt500b/public_html/themooliecommunity.com/CSGO/index.php on line 24
我可以确认 allow_url_fopen 已开启
将以下 url 粘贴到浏览器中表明 url 有效
请注意,大约 1 小时前这行得通,但现在抛出错误,有什么建议吗?
您已收到状态为 429 Too many requests
的回复
The user has sent too many requests in a given amount of time ("rate
limiting").
所以这个网站可以阻止过于频繁地引用他的 API
HTTP 429 是请求过多的警告,它不是错误,只是告诉您您做得有点过头的提示。您将不得不等待一段时间,或者如果它是您自己的服务器,则调整它的设置以允许更多请求。
我正在尝试访问 Steam 提供的多个 json 文件,以获取 CSGO 物品的市场价格。我使用的第一个 file_get_contents 有效:
$inventory = file_get_contents('http://steamcommunity.com/profiles/' . $steamprofile['steamid'] . '/inventory/json/730/2');
但是第二个开始不起作用:
$marketString = file_get_contents('http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=' . urlencode($json_a->{'rgDescriptions'}->$rgDescrId->{'market_hash_name'}));
但是我在所有项目上都遇到了错误,例如:
Warning: file_get_contents(http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Negev%20|%20Nuclear%20Waste%20(Minimal%20Wear)): failed to open stream: HTTP request failed! HTTP/1.0 429 Unknown in /home4/matt500b/public_html/themooliecommunity.com/CSGO/index.php on line 24
我可以确认 allow_url_fopen 已开启
将以下 url 粘贴到浏览器中表明 url 有效
请注意,大约 1 小时前这行得通,但现在抛出错误,有什么建议吗?
您已收到状态为 429 Too many requests
的回复The user has sent too many requests in a given amount of time ("rate limiting").
所以这个网站可以阻止过于频繁地引用他的 API
HTTP 429 是请求过多的警告,它不是错误,只是告诉您您做得有点过头的提示。您将不得不等待一段时间,或者如果它是您自己的服务器,则调整它的设置以允许更多请求。