WeChat public platform developer list

Source: Internet
Author: User
This article describes how to use advanced interfaces on the public platform to develop the function of obtaining the list of referers. This article describes how to use advanced interfaces on the public platform to develop the function of obtaining the list of referers.

I. interface introduction

The public account can be obtained through this interface. the list of accounts is composed of a string of OpenIDs (encrypted numbers, each user has a unique OpenID for each public account. One pull call can pull the OpenID of up to 10000 referers. you can use multiple pull requests to meet your requirements.

API call request description

Http request method: GET (please use https protocol) https://api.weixin.qq.com/cgi-bin/user/get? Access_token = ACCESS_TOKEN & next_openid = NEXT_OPENID
Parameters Required? Description
Access_token Yes Interface call credential
Next_openid Yes The first OPENID to be pulled. If this parameter is not specified, the OPENID is pulled from the beginning by default.

Return description

Return the JSON data packet if the data is correct:

{"total":2,"count":2,"data":{"openid":["","OPENID1","OPENID2"]},"next_openid":"NEXT_OPENID"}

Parameters Description
Total Follow the total number of users of this public account
Count The number of OpenIDs pulled. The maximum value is 10000.
Data List data, OPENID list
Next_openid OPENID of the last user who pulls the list

JSON data packet is returned when an error occurs (the AppID is invalid in this example ):

{"errcode":40013,"errmsg":"invalid appid"}

Appendix: when the number of consumers exceeds 10000

When the number of public accounts exceeds 10000, you can enter the value of next_openid to retrieve the list multiple times.

Specifically, the value of next_openid returned by the last call is used as the value of next_openid in the next call.

Example:

Public Account A has 23000 followers, and want to get all followers by pulling the followers interface, then the request url is as follows: https://api.weixin.qq.com/cgi-bin/user/get? Access_token = ACCESS_TOKEN:

{  "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 return result:

{   "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 return result (if the handler list has been returned, the returned next_openid is empty ):

$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);


II. program implementation

 = "" = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" = https_request( = json_decode(, (

After the CMB is launched, the returned result is similar to the following:

{   "total":23000,   "count":10000,   "data":{     "openid":[       "OPENID10001",       "OPENID10002",       ...,       "OPENID20000"     ]   },   "next_openid":"NEXT_OPENID2"}

If the number exceeds 10 thousand, you can execute the above program cyclically and save the openid to the database to obtain the list of users.

This interface is used to obtain basic user information and user group interfaces to obtain basic information and groups of all consumers.

For more articles about public platform development and getting the publisher list, refer to PHP Chinese network!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.