2017-04-23 13 views
0

特定のURLでfile_get_contents()が失敗する:ストリームのオープンに失敗しました:HTTP要求に失敗しました! HTTP /私はスチームAPIを使用しようとしていますが、私はスチームコミュニティURLを()のfile_get_contentsを使用するたびに、私はこのエラーを取得する1.0 429

Warning: file_get_contents(http://steamcommunity.com/market/priceoverview/?currency=1&appid=578080&market_hash_name=Gas%20Mask): failed to open stream: HTTP request failed! HTTP/1.0 429 

私はGoogle.comで()のfile_get_contentsを使用している場合は、たとえば、エラーなしでページを返します。私はランダムな文字を返すカールを使用しようとしました。ここで私が使用したコードは次のとおりです。

// create curl resource 
$ch = curl_init(); 

// set url 
curl_setopt($ch, CURLOPT_URL, "http://steamcommunity.com/market/priceoverview/?currency=1&appid=578080&market_hash_name=Gas%20Mask"); 

//return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

// $output contains the output string 
$output = curl_exec($ch); 

// close curl resource to free up system resources 
curl_close($ch); 

echo $output; 

結果:

��+��O��% 
+0

file_get_contentsの代わりにcurlを試してみましたか? – Peter

+0

私はcurlを使うと、 + O %を返します。 –

+0

あなたの質問をあなたが試したコードで更新してください – Peter

答えて

0

が私のドメインが一時的にURLへのリクエストを行うことは禁止されました。私は別のサーバー上でコードをテストし、それがうまくいった。

関連する問題