PHP公众号的高级群发接口不能上传图文消息素材,返回errcode:-2errmsg:''
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了PHP公众号的高级群发接口不能上传图文消息素材,返回errcode:-2errmsg:'',小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3054字,纯文字阅读大概需要5分钟。
内容图文
![PHP公众号的高级群发接口不能上传图文消息素材,返回errcode:-2errmsg:''](/upload/InfoBanner/zyjiaocheng/239/40b25a94c19c4a41ae29a2d11c4e2933.jpg)
array
'errcode' => int -2
'errmsg' => string '' (length=0)
请问这是什么问题?
--------------------------- 原代码 ----------------------------
$news[] = array("thumb_media_id"=>$image_list[0], "author"=>"kxc", "title"=>"最新公告1", "content_source_url"=>"lejia51.com", "content"=>"--", "digest"=>"notice", "show_cover_pic"=>"1");
$news[] = array("thumb_media_id"=>$image_list[1], "author"=>"kxc", "title"=>"最新公告2", "content_source_url"=>"lejia51.com", "content"=>"--", "digest"=>"notice", "show_cover_pic"=>"0");
?
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=" . $this->token();
$json = json_encode(array("articles"=>$news));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
$data = curl_exec($curl);
if (curl_errno($curl)) {
$this->write_file(curl_error($curl));
return null;
}
$result = json_decode($data, true);
curl_close($this->cur);
var_dump($result);
回复内容:
POST数据到https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=ACCESS...(ACCESS_TOKEN是我自己的),返回如下:
array
'errcode' => int -2
'errmsg' => string '' (length=0)
请问这是什么问题?
--------------------------- 原代码 ----------------------------
$news[] = array("thumb_media_id"=>$image_list[0], "author"=>"kxc", "title"=>"最新公告1", "content_source_url"=>"lejia51.com", "content"=>"--", "digest"=>"notice", "show_cover_pic"=>"1");
$news[] = array("thumb_media_id"=>$image_list[1], "author"=>"kxc", "title"=>"最新公告2", "content_source_url"=>"lejia51.com", "content"=>"--", "digest"=>"notice", "show_cover_pic"=>"0");
?
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=" . $this->token();
$json = json_encode(array("articles"=>$news));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
$data = curl_exec($curl);
if (curl_errno($curl)) {
$this->write_file(curl_error($curl));
return null;
}
$result = json_decode($data, true);
curl_close($this->cur);
var_dump($result);
曾经看过一次类似的问题
别人最后用UTF8 解决了
建议参考下小懒人http://www.mptool.cn
内容总结
以上是互联网集市为您收集整理的PHP公众号的高级群发接口不能上传图文消息素材,返回errcode:-2errmsg:''全部内容,希望文章能够帮你解决PHP公众号的高级群发接口不能上传图文消息素材,返回errcode:-2errmsg:''所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。