2016-02-29 23 views
2

我試圖讓這個JSON的內容捲曲JSON:http://steamcommunity.com/market/pricehistory/?country=DE&currency=3&appid=730&market_hash_name=Chroma%20Case與餅乾回報「<ŠŽÿÿ)»L」

這是我的代碼:

$url = "http://steamcommunity.com/market/pricehistory/?country=DE&currency=3&appid=730&market_hash_name=Chroma%20Case"; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

curl_setopt($ch, CURLOPT_COOKIE, 'steamLogin = 76561198075419487%7C%7C3F1A776553C4BE1D0F6DA83059052E79DB7EB3C7'); 

$output = curl_exec($ch); 
$info = curl_getinfo($ch); 
curl_close($ch); 

$json_string = json_encode($output, JSON_PRETTY_PRINT); 

當打印$json_string它導致沒有,$output結果在「<ŠŽÿÿ)」L「。我想抓住網站上的實際內容,steamLogin -Cookie是需要的。目前存儲在瀏覽器中的cookie是我在源代碼中硬編碼的cookie。

如果您需要更多信息,請隨時詢問。

+1

嘗試加入'curl_setopt($ CH,CURLOPT_ENCODING, 「」);'(處理被gzip壓縮響應) - 圍繞'='在cookie看起來錯的空間。 –

+0

@AlexK。謝謝!這真的做到了! :) – njoye

回答

1

添加curl_setopt($ch, CURLOPT_ENCODING,"");使它:)