公告:魔扣目录网为广大站长提供免费收录网站服务,提交前请做好本站友链:【 网站目录:https://www.morko.net 】, 免友链快审服务(50元/站),

点击这里在线咨询客服
新站提交
  • 网站:51998
  • 待审:31
  • 小程序:12
  • 文章:1030137
  • 会员:747

PHP根据微信开放文档开发的几个DEMO实例,本人正在做一款自动生成文章,群发图文消息给关注的用户,有公众号粉丝的朋友开发好自动赚流量主广告推广费 PHP开发微信公众号流量主自动生成文章群发图文消息

目前用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

分享到:
标签:源码 消息 图文 群发
用户无头像

网友整理

注册时间:

网站:5 个   小程序:0 个  文章:12 篇

  • 51998

    网站

  • 12

    小程序

  • 1030137

    文章

  • 747

    会员

赶快注册账号,推广您的网站吧!
最新入驻小程序

数独大挑战2018-06-03

数独一种数学游戏,玩家需要根据9

答题星2018-06-03

您可以通过答题星轻松地创建试卷

全阶人生考试2018-06-03

各种考试题,题库,初中,高中,大学四六

运动步数有氧达人2018-06-03

记录运动步数,积累氧气值。还可偷

每日养生app2018-06-03

每日养生,天天健康

体育训练成绩评定2018-06-03

通用课目体育训练成绩评定