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

Example Analysis of Wechat Interface Development

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the example analysis of Wechat interface development, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know it.

Signature verification is required during the creation process, as described below:

After the user of the public platform submits the information, we will request it to the entered Url in the form of GET request, with four parameters:

* signature-Wechat encryption signature

* timestamp-timestamp

* nonce-Random number

* echostr-Random string

Developers verify the validity of URL access by verifying signature. If the content of the echostr parameter is returned as is for this GET request, the access takes effect, otherwise the connection fails. The verification signature will be combined with the token parameters, timestamp parameters and nonce parameters entered by the developer, and the encryption process:

* sort the three parameters token, timestamp and nonce in lexicographic order

* concatenate three parameter strings into one string for SHA1 encryption

* the encrypted string obtained by the developer can be compared with signature to indicate that the request originated from Wechat.

Code:

However, Wechat does not transmit data through json:

So use simplexml_load_string to load XML data as objects, and find that the POST method is not urlencode, so set HTTP_RAW_POST_DATA, and then you can read the data.

The WeChat account of the recipient of ToUserName message, which is usually the Wechat account of the public platform.

Wechat account of the sender of the FromUserName message

CreateTime message creation time

MsgType text message is text

Content message content

Thank you for reading this article carefully. I hope the article "sample Analysis of Wechat Interface Development" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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