Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get an instance of Wechat server IP address

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to get Wechat server IP address examples, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

1. Obtain the instance of Wechat server IP address

(1) Interface introduction

If the official account is based on security and other considerations, you need to know the IP address list of the Wechat server in order to impose relevant restrictions. You can obtain the Wechat server IP address list or IP network segment information through this API.

(2) instance call

Interface description

Http request method: GET

API call address:

Api.weixin.qq.com/cgi-bin/getcallbackip?access_token=ACCESS_TOKEN

Request parameter description, as shown in the table:

Parameters.

Is it necessary

Description

Access_token

Yes

Access_token of official account

Return description:

Normally, Wechat will return the JSON packet to the official account, as shown in the figure:

Returns the parameter description of the information, as shown in the table:

Parameters.

Description

Ip_list

List of Wechat server IP addresses

Code:

Code parsing:

Require ('wei_function.php'); contains wei_function.php

Use the getdata () function to get the access_token and continue to replace the access_ token value of the $ipurl value

$iparr= (array) json_decode (getdata ($ipurl)); get the data of $ipurl through the getdata () function, and then get the $iparr after processing by the json_decode function. In this case, the value of the variable is a two-dimensional array, as shown in the figure.

What we need is [ip_list] in the array, so we take out the array set of [ip_list] separately and loop out each Wechat server IP through foreach.

Code:

Foreach ($iparr ['ip_list'] as $key = > $value) {echo $value. "

"; / / print IP collections in a circular manner}

Run the program to call the interface result, as shown in the figure.

The above is all the contents of the article "how to get an example of a Wechat server IP address". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report