微信高级群发消息接口分组出错问题 20
微信高级群发接口,调用分组群发,返回值为{"errcode":44003,"errmsg":"emptynewsdata"}但是代码中$data有值具体代码$url="h...
微信高级群发接口,调用分组群发,返回值为{"errcode":44003,"errmsg":"empty news data"} 但是代码中$data有值 具体代码 $url="https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=".$access_token;
$data="{
'filter':{
'group_id':'104'
},
'mpnews':{
'media_id':'".$media_id."'
},
'msgtype':'mpnews'
}";
// $opts = array ('http' => array ('method' => 'POST','content'=>$data, 'header' => 'Content-type: application/x-www-form-urlencoded' ) );
// $context = stream_context_create ($opts);
// $result = file_get_contents ( $url, FALSE, $context );
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
echo $output; 展开
$data="{
'filter':{
'group_id':'104'
},
'mpnews':{
'media_id':'".$media_id."'
},
'msgtype':'mpnews'
}";
// $opts = array ('http' => array ('method' => 'POST','content'=>$data, 'header' => 'Content-type: application/x-www-form-urlencoded' ) );
// $context = stream_context_create ($opts);
// $result = file_get_contents ( $url, FALSE, $context );
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
echo $output; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询