Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 带cookie的curl json返回‹ŠŽÿÿ;)»;L";_Php_Json_Curl_Cookies - Fatal编程技术网

Php 带cookie的curl json返回‹ŠŽÿÿ;)»;L";

Php 带cookie的curl json返回‹ŠŽÿÿ;)»;L";,php,json,curl,cookies,Php,Json,Curl,Cookies,我正在尝试获取此json的内容: 这是我的代码: $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_RETURNTRANS

我正在尝试获取此json的内容:

这是我的代码:

$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


如果您需要更多信息,请随时询问。

添加
curl\u setopt($ch,CURLOPT\u ENCODING,”)成功:)

尝试添加
curl\u setopt($ch,CURLOPT\u ENCODING,”)
(处理被gzip处理的响应)-cookie中
=
周围的空格看起来是错误的。@AlexK。谢谢真的做到了!:)