Table of Contents
1. Set the user remark name
2. Obtain basic user information
3. Get user messages in batches
4. Create Tag
5. Get to create tags
6. Edit tag
7. Delete tag
8. Tag users in batches
9. Get the list of fans under the tag
10. Get the tag list on the user
Home WeChat Applet WeChat Development WeChat public account implements user management function

WeChat public account implements user management function

Sep 14, 2017 am 10:47 AM
Function user manage

1. Set the user remark name

Interface: https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN

updateremark. php

<?php
require_once("../Utils.php");
$data = &#39;{
    "openid":"o4WmZ0h-4huBUVQUczx2ezaxIL9c",
    "remark":"Jhon"
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{"errcode":0,"errmsg":"ok"}
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

2. Obtain basic user information

Interface: https://api.weixin.qq.com/cgi-bin/user/info ?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN

userInfp.php

<?php
require_once("../Utils.php");
$openId = "o4WmZ0h-4huBUVQUczx2ezaxIL9c";
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token="
    .Utils::get_access_token()."&openid=".$openId."&lang=zh_CN ";
$result = Utils::https_request($url);
echo $result;
Copy after login

Return:

{
    "subscribe": 1,
    "openid": "o4WmZ0h-4huBUVQUczx2ezaxIL9c",
    "nickname": "Promise",
    "sex": 1,
    "language": "zh_CN",
    "city": "",
    "province": "",
    "country": "",
    "headimgurl": "http://wx.qlogo.cn/mmopen/Vq7PMkMOaMYgtQNJBrdesiantXGgGkliaoI3StUtnG5DUA1oYaeTlOdjicYHu9EkMvLY2gXf7rHBzGNiaPoDyvmZ0ONEGm7PfGBb/0",
    "subscribe_time": 1504708412,
    "remark": "Jhon",
    "groupid": 0,
    "tagid_list": []
}
Copy after login

3. Get user messages in batches

Interface: https:/ /api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN

batchget.php

<?php
require_once("../Utils.php");
$data = &#39;{
    "user_list": [
       {
           "openid": "o4WmZ0h-4huBUVQUczx2ezaxIL9c",
           "lang": "zh_CN"
       }
   ]
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/user/info/batchget?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{
    "user_info_list": [
        {
            "subscribe": 1,
            "openid": "o4WmZ0h-4huBUVQUczx2ezaxIL9c",
            "nickname": "Promise",
            "sex": 1,
            "language": "zh_CN",
            "city": "",
            "province": "",
            "country": "",
            "headimgurl": "http://wx.qlogo.cn/mmopen/Vq7PMkMOaMYgtQNJBrdesiantXGgGkliaoI3StUtnG5DUA1oYaeTlOdjicYHu9EkMvLY2gXf7rHBzGNiaPoDyvmZ0ONEGm7PfGBb/0",
            "subscribe_time": 1504708412,
            "remark": "Jhon",
            "groupid": 0,
            "tagid_list": []
        }
    ]
}
Copy after login

4. Create Tag

Interface: https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKEN

tags_create.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
    "tag" : {
        "name" : "朋友"
  }
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/create?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{
    "tag": {
        "id": 101,
        "name": "朋友"
    }
}
Copy after login

5. Get to create tags

Interface: https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN

tags_get.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token="
    .Utils::get_access_token();
$result = Utils::https_request($url);
echo $result;
Copy after login

Return:

{
    "tags": [
        {
            "id": 2,
            "name": "星标组",
            "count": 0
        },
        {
            "id": 100,
            "name": "同学",
            "count": 0
        },
        {
            "id": 101,
            "name": "朋友",
            "count": 0
        }
    ]
}
Copy after login

6. Edit tag

interface: https://api.weixin.qq.com/cgi-bin/tags/update ?access_token=ACCESS_TOKEN

tags_update.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
    "tag" : {
        "id" : 101,
    "name" : "好朋友"
  }
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/update?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{"errcode":0,"errmsg":"ok"}
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

7. Delete tag

When the number of fans under a certain tag exceeds 100,000, Tags cannot be deleted directly in the background. At this time, developers can first cancel the label in the openid list under the label, and then delete the label directly until the number of fans does not exceed 100,000.

Interface: https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN

tags_delete.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
    "tag" : {
        "id" : 101
    }
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/delete?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{"errcode":0,"errmsg":"ok"}
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

8. Tag users in batches

The tag function currently supports official accounts to tag up to 20 users.

Interface: https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN

tags_batchtagging.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
    "openid_list" : [
        "o4WmZ0h-4huBUVQUczx2ezaxIL9c"
    ],
  "tagid" : 100
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return result:

{"errcode":0,"errmsg":"ok"}
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

9. Get the list of fans under the tag

Interface: https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token =ACCESS_TOKEN

"next_openid":""//The first OPENID pulled, if not filled in, it will be pulled from the beginning by default

tags_get_user.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
  "tagid" : 100,
  "next_openid":""
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/user/tag/get?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{
    "count": 1,
    "data": {
        "openid": [
            "o4WmZ0h-4huBUVQUczx2ezaxIL9c"
        ]
    },
    "next_openid": "o4WmZ0h-4huBUVQUczx2ezaxIL9c"
}
Copy after login

10. Get the tag list on the user

Interface; https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN

tags_getidlist.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
  "openid" : "o4WmZ0h-4huBUVQUczx2ezaxIL9c"
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/getidlist?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{
    "tagid_list": [
        100
    ]
}
Copy after login

11. Cancel tags for users in batches

Interface: https://api.weixin.qq.com/ cgi-bin/tags/members/batchuntagging?access_token=ACCESS_TOKEN

tags_batchuntagging.php

<?php
@header(&#39;Content-type: text/plain;charset=UTF-8&#39;);
require_once("../Utils.php");
$data = &#39;{
    "openid_list" : [
        "o4WmZ0h-4huBUVQUczx2ezaxIL9c"
    ],
  "tagid" : 100
}&#39;;
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?"
    ."access_token=".Utils::get_access_token();
$result = Utils::https_request($url, $data);
echo $result;
Copy after login

Return:

{"errcode":0,"errmsg":"ok"}
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

The above is the detailed content of WeChat public account implements user management function. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use Xiaohongshu account to find users? Can I find my mobile phone number? How to use Xiaohongshu account to find users? Can I find my mobile phone number? Mar 22, 2024 am 08:40 AM

With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the &quot;Discover&quot; button in the lower right corner, and then select the &quot;Notes&quot; option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the &quot;Follow&quot; button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select &quot;Personal Information&quot;

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

What functions does Doubao app have? What functions does Doubao app have? Mar 01, 2024 pm 10:04 PM

There will be many AI creation functions in the Doubao app, so what functions does the Doubao app have? Users can use this software to create paintings, chat with AI, generate articles for users, help everyone search for songs, etc. This function introduction of the Doubao app can tell you the specific operation method. The specific content is below, so take a look! What functions does the Doubao app have? Answer: You can draw, chat, write articles, and find songs. Function introduction: 1. Question query: You can use AI to find answers to questions faster, and you can ask any kind of questions. 2. Picture generation: AI can be used to create different pictures for everyone. You only need to tell everyone the general requirements. 3. AI chat: can create an AI that can chat for users,

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

Analysis of user password storage mechanism in Linux system Analysis of user password storage mechanism in Linux system Mar 20, 2024 pm 04:27 PM

Analysis of user password storage mechanism in Linux system In Linux system, the storage of user password is one of the very important security mechanisms. This article will analyze the storage mechanism of user passwords in Linux systems, including the encrypted storage of passwords, the password verification process, and how to securely manage user passwords. At the same time, specific code examples will be used to demonstrate the actual operation process of password storage. 1. Encrypted storage of passwords In Linux systems, user passwords are not stored in the system in plain text, but are encrypted and stored. L

PHP Tips: Quickly Implement Return to Previous Page Function PHP Tips: Quickly Implement Return to Previous Page Function Mar 09, 2024 am 08:21 AM

PHP Tips: Quickly implement the function of returning to the previous page. In web development, we often encounter the need to implement the function of returning to the previous page. Such operations can improve the user experience and make it easier for users to navigate between web pages. In PHP, we can achieve this function through some simple code. This article will introduce how to quickly implement the function of returning to the previous page and provide specific PHP code examples. In PHP, we can use $_SERVER['HTTP_REFERER'] to get the URL of the previous page

See all articles