2016-03-11 31 views
0

我想訪問多個由蒸汽提供的CSGO項目的市場價格的JSON文件。我使用的作品第一的file_get_contents: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'})); 

但是我得到的所有項目,例如錯誤:

警告: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 /home4/matt500b/public_html/themooliecommunity.com/CSGO/index.php未知上線24

我可以證實了allow_url_fopen是

粘貼以下網址成瀏覽器顯示的URL工作

http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Negev%20|%20Nuclear%20Waste%20(Minimal%20Wear)

請注意,約1小時前的這個工作,但現在拋出一個錯誤,有什麼建議?

+0

429太多的請求(RFC 6585) 用戶在給定的時間內發送了太多的請求。旨在用於限速方案。[57] –

回答

1

你得響應與狀態429 Too many requests

用戶在給定的時間量(「速度 限制」)發送的請求過多。

那麼這個網站可以直接阻擋太頻繁引用他的API

1

一個HTTP 429是太多要求的警告,這是不是一個錯誤,只是一張紙條,告訴你,你已經在做了一個小。你必須等待一段時間,或者如果它是你自己的服務器,然後調整它的設置以允許更多的請求。