为什么file_get_contents()返回“无法打开流:HTTP请求失败!”? HTTP / 1.0 429未知

时间:2015-11-15 11:44:08

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

我遇到了file_get_contents问题。我需要从此网址获取内容: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

1 个答案:

答案 0 :(得分:0)

根据错误消息,您从Steam的服务器收到<!DOCTYPE html> <html> <head> <title> Drawing Canvas</title> <link rel='stylesheet' type="text/css" href = 'drawingMain.css'> </head> <body> <div id = 'container'> <div id='body'> <h1 class = 'heading'> Welcome to a Drawing Canvas!!</h1> <canvas id ='drawing' > A sample drawing <! this will be shown if canvas doesnt work in the browser !> </canvas> </div> <div id ='clearBtnDiv'> <input type="submit" value="Clear" id ='clearBtn' > </div> </div> <script type="text/javascript" src= 'drawing.js'> </script> </body> </html> HTTP错误:

429

Source