WeChat public platform development to obtain followers list
Mar 04, 2017 am 11:41 AMThis article introduces how to use advanced interfaces to develop the function of obtaining the follower list on the WeChat public platform.
1. Interface Introduction
Official accounts can obtain the account’s follower list through this interface. The follower list consists of a string of OpenID ( The encrypted WeChat account (each user’s OpenID for each official account is unique). A single pull call can pull up to 10,000 OpenIDs of followers, and you can pull multiple times to meet your needs.
Interface call request description
http請求方式:?GET(請使用https協(xié)議) https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
Parameter | Whether it is required | Description |
---|---|---|
access_token | is | Call interface credentials |
next_openid | is | The first OPENID to be pulled, if not filled in, it will be pulled from the beginning by default |
Return instructions
Return when correct JSON data packet:
{"total":2,"count":2,"data":{"openid":["","OPENID1","OPENID2"]},"next_openid":"NEXT_OPENID"}
Description | |
---|---|
The total number of users following the public account | |
The number of OPENIDs pulled, the maximum value is 10000 | |
List data, list of OPENID | |
Pull the OPENID of the next user in the list |
{"errcode":40013,"errmsg":"invalid?appid"}
Attachment: When the number of followers exceeds 10,000
When the number of followers of the public account exceeds 10,000, you can fill in the value of next_openid and pull the list multiple times to meet the needs. Specifically, when calling the interface, the next_openid value returned from the previous call is used as the next_openid value in the next call. Examples are as follows:公眾賬號A擁有23000個關(guān)注的人,想通過拉取關(guān)注接口獲取所有關(guān)注的人,那么分別請求url如下: https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN? 返回結(jié)果:
{ ??"total":23000, ??"count":10000, ??"data":{" ?????openid":[ ????????"OPENID1", ????????"OPENID2", ????????..., ????????"OPENID10000" ?????] ???}, ???"next_openid":"NEXT_OPENID1" }
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID1 返回結(jié)果:
{???"total":23000, ???"count":10000, ???"data":{?????"openid":[???????"OPENID10001", ???????"OPENID10002", ???????..., ???????"OPENID20000" ?????] ???}, ???"next_openid":"NEXT_OPENID2"}
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID1 返回結(jié)果(關(guān)注者列表已返回完時,返回next_openid為空):
$access_token?=?""; $url?=?"https://api.weixin.qq.com/cgi-bin/user/get?access_token=$access_token"; $result?=?https_request($url); $jsoninfo?=?json_decode($result,?true); var_dump($result);
?=?""?=?"https://api.weixin.qq.com/cgi-bin/user/get?access_token="?=?https_request(?=?json_decode(,?(After CMB, the return will be similar to the following:
{ ???"total":23000, ???"count":10000, ???"data":{ ?????"openid":[ ???????"OPENID10001", ???????"OPENID10002", ???????..., ???????"OPENID20000" ?????] ???}, ???"next_openid":"NEXT_OPENID2" }For numbers exceeding 10,000, just execute the above program in a loop, store these openids in the database, and obtain the list of followers. The main function of this interface is to cooperate with the interface to obtain basic user information and user grouping to obtain the basic information and grouping of all followers. For more articles related to WeChat public platform development and obtaining followers list, please pay attention to the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
