PHP开发微信公众号流量主自动生成文章群发图文消息【原创

来源:https://www.sucaihuo.com/php/5206.html 2021-02-15 08:30浏览(480) 收藏

这些DEMO仅供开发者学习参考,避免走弯路,这些都是本人亲自开发测试,现在在用thinkphp5开发完整的平台,需要购买或者定制的朋友直接加我qq1206995177

PHP根据微信开放文档开发的几个DEMO实例,本人正在做一款自动生成文章,群发图文消息给关注的用户,有公众号粉丝的朋友开发好自动赚流量主广告推广费
PHP开发微信公众号流量主自动生成文章群发图文消息
分类:PHP > 微信 难易:初级
下载资源 下载积分: 500 积分

目前用PHP原生开发的7个DEMO,每个都带有文档地址和接口调用地址,这些接口正在开发中,后面下载的用户免费下载

1、获取公众号已创建的标签 biaoqian_lists.php

//文档:https://developers.weixin.qq.com/doc/offiaccount/User_Management/User_Tag_Management.html
//接口调用:https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN

2、新增临时素材

//文档:https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html
//接口调用:https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE

3、上传图文消息内的图片获取URL(上传图文消息内的图片获取URL,在素材库里看不到,不占用公众号素材库限制10000个) sucai_message_inner_pic.php

//文档:https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Adding_Permanent_Assets.html
//接口调用:https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN

4、新增文章 sucai_news_add.php

//文档:https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Adding_Permanent_Assets.html
//接口调用:https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=ACCESS_TOKEN
function get_access_token() {
    $appid = 'wx0fa9475891599';
    $secret = 'f96dbe01750027fdc0e81228effa';
    $url_token = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret . "";
    $curl_token = curl_get($url_token);
//print_r($curl_token);exit;
    $access_token = $curl_token['access_token'];
    return $access_token;
}

$access_token = get_access_token(); //获取access_token
$url_material = "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=" . $access_token . ""; //调用该接口需https协议
//echo iconv('UTF-8', 'GB2312', '站长货小小a');exit;



$media = '{
    "articles": [{
     "title": "素材火",
    "thumb_media_id": "x5uMq7UJhIdhGdADoIKzJsiAfZkQ4BiIcZQA-klCdp8",
    "author": "素材火",
    "digest": "素材火",
    "show_cover_pic": 1,
    "content": "PHP微信社区团购生鲜商城系统源码蔬菜百货超市连锁微商城源码",
    "content_source_url": "https://www.sucaihuo.com/source/12434.html",
},
    //若新增的是多图文素材,则此处应还有几段articles结构
]
}';
$curl_upload = curl_post($url_material, 'post', $media);
print_r($curl_upload);

5、新增永久图文素材(在素材库里可查看,官方限制10000个)sucai_pic_add.php

//文档:https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Adding_Permanent_Assets.html
//接口调用:https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE

6、获取用户信息 user_info.php

//接口调用:https://api.weixin.qq.com/cgi-bin/user/info?access_token=$access_token&openid=$openid&lang=zh_CN

7、获取用户openid user_openid.php

//文档:https://developers.weixin.qq.com/doc/offiaccount/User_Management/Getting_a_User_List.html
//接口调用:https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
标签: 群发流量主
声明:本文为原创文章,如需转载,请注明来源sucaihuo.com并保留原文链接:https://www.sucaihuo.com/php/5206.html
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2