In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the WeChat public platform development configuration, request example analysis, has a certain reference value, interested friends can refer to, I hope you read this article after a lot of gains, the following let Xiaobian take you to understand.
I. Configuration parameters define('WEIXIN_APPID', 'wxzz');define('WEIXIN_APPSECRET', 'ouewjdsaudsamkh');define('WEIXIN_TOKEN', '9973833232232');define('WEIXIN_NOTIFY_URL', 'http://xx.com/xx/xx');define('WEIXIN_MCHID', '32221121');define('WEIXIN_KEY', ' xddswew');
1) ID under development for Weixin Official Accounts
WEIXIN_APPID: Application ID
WEIXIN_APPSECRET: Application Key
Go to the homepage of the public platform, click on the developer center, and you will be able to see, in the configuration page, these two defaults are there.
2) Server configuration
WEIXIN_TOKEN, i.e. token token, custom, must be English or numeric, length 3-32 characters.
URL server address, that is, the entry address of Weixin Official Accounts. In this page, I will do signature verification or receive event messages
1. Signature verification: When modifying the configuration, it is necessary to verify the signature through this address.
2. Receive event messages: It refers to pushing some messages when paying attention, and can do some specific logical operations.
3) Weixin Pay Configuration
Click the Weixin Pay menu
WEIXIN_MCHID: merchant number, which can be viewed in merchant information
WEIXIN_NOTIFY_URL: Weixin Pay asynchronous callback API, can update order status, send push logic, etc.
WEIXIN_KEY: To set this payment key, you need to log in to Weixin Pay merchant platform. After logging in, click to enter API security, then download certificate and set key yourself, and then OK.
II. Request and debugging
php has a handy curl, here mentioned CURLOPT_SSL_VERIFYPEER. This attribute was not added at first, and the data returned each time when requesting WeChat server is false. HttpRequester simulation request with firefox later, you can return to the data, after looking up the information found to set this property.
CURLOPT_SSL_VERIFYPEER: Whether to check whether the server certificate is issued by an authorized CA authenticated by a regular browser
/** * Original POST * @param $url URL URL of the request * @param $raw raw data, can be string or array * @return mixed Return the requested value */ public function rawpost($url, $raw) { $resource = curl_init(); curl_setopt($resource, CURLOPT_POST, true); curl_setopt($resource, CURLOPT_URL, $url); curl_setopt($resource, CURLOPT_POSTFIELDS, $raw); curl_setopt($resource, CURLOPT_RETURNTRANSFER, true); curl_setopt($resource, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false); //curl_setopt($resource, CURLOPT_HTTPHEADER, array('Expect:')); $data = curl_exec($resource); curl_close($resource); return $data; }
HttpRequester is recommended here. This plug-in can simulate post, get and other submissions. The content type can also be selected.
WeChat developers also provide a place for online testing interfaces.
When debugging is requested, WeChat will return various return codes. Click to view global return code description.
Thank you for reading this article carefully. I hope that the article "Example Analysis of WeChat Public Platform Development Configuration and Request" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you more, pay attention to the industry information channel, and more relevant 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.