【发布时间】:2016-03-11 00:49:17
【问题描述】:
我正在尝试访问 Steam 提供的多个 json 文件,以获取 CSGO 商品的市场价格。我正在使用第一个有效的 file_get_contents:
$inventory = file_get_contents('http://steamcommunity.com/profiles/' . $steamprofile['steamid'] . '/inventory/json/730/2');
但第 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'}));
但是我得到了所有项目的错误,例如:
警告:file_get_contents(http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Negev%20|%20Nuclear%20Waste%20(Minimal%20Wear)):打开流失败:HTTP 请求失败! HTTP/1.0 429 Unknown in /home4/matt500b/public_html/themooliecommunity.com/CSGO/index.php 第 24 行
我可以确认 allow_url_fopen 已开启
将以下网址粘贴到浏览器中表明该网址有效
请注意,大约 1 小时前这有效,但现在抛出错误,有什么建议吗?
【问题讨论】:
-
429 Too Many Requests (RFC 6585) 用户在给定时间内发送的请求过多。旨在与速率限制方案一起使用。[57]
标签: php api http-headers