【问题标题】:Why file_get_contents() returns “failed to open stream: HTTP request failed!”? HTTP/1.0 429 Unknown为什么 file_get_contents() 返回“未能打开流:HTTP 请求失败!”? HTTP/1.0 429 未知
【发布时间】:2016-02-16 14:27:13
【问题描述】:

我在使用 file_get_contents 时遇到问题。我需要从这个 url 获取内容:http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=P250%20|%20Valence%20(Field-Tested)

当我用浏览器打开它时效果很好,我的 php 脚本:

$item = "P250 | Valence (Field-Tested)"; $link = 'http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name='.urlencode($item); echo file_get_contents($link);

向我抛出此错误:
Warning: file_get_contents(http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=P250+%7C+Valence+%28Field-Tested%29): failed to open stream: HTTP request failed! HTTP/1.0 429 Unknown

【问题讨论】:

    标签: php json file-get-contents http-status-code-429


    【解决方案1】:

    根据错误消息,您从 Steam 的服务器收到429 HTTP 错误:

    429 Too Many Requests (RFC 6585)
    The user has sent too many requests in a given amount of time. Intended for use with rate limiting schemes.
    

    Source

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-13
      • 2010-10-16
      • 1970-01-01
      • 2014-09-25
      • 1970-01-01
      • 2012-03-23
      • 1970-01-01
      • 2012-07-26
      相关资源
      最近更新 更多