3 回复
Content-type:application/json 试试,安装个Fiddler看下body中是否是json字符串
$data 转换成json=>{ start:0,limit:10 } 而非查询字符串 start=0&limit=10
$data = array(
"start"=>0,
"limit"=>10
);
$query = http_build_query($data);
$options['http'] = array(
// 'access_token'=>$access_token,
'timeout'=>60,
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded;charset=utf-8',
'content' => $query
);
$url = 'https://api.weixin.qq.com/wxa/business/getliveinfo?access_token='.$access_token;
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$resultT = json_decode($result, true);
echo $resultT;
执行结果:
Array{"errcode":47001,"errmsg":"data format error hint: [q9NUXa09384812]"}
