In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "how to understand the configuration and request of Wechat public platform development". Many people will encounter this dilemma in the operation of actual cases. then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
I. configuration parameters
Define ('WEIXIN_APPID',' wxzzzzzzzz'); define ('WEIXIN_APPSECRET',' ouewjdsaudsamkh'); define ('WEIXIN_TOKEN',' 9973833232232'); define ('WEIXIN_NOTIFY_URL',' http://xx.com/xx/xx');define('WEIXIN_MCHID', '322221121'); define ('WEIXIN_KEY',' xddsdswewew')
1) ID in the development of Wechat official account
WEIXIN_APPID: apply ID
WEIXIN_APPSECRET: application key
Go to the home page of the public platform, click on the developer Center, and you will be surprised to see that these two defaults are available on the configuration page.
2) Server configuration
WEIXIN_TOKEN, or token token, is custom, must be in English or numeric, and is 3-32 characters long.
The URL server address, that is, the entrance address of the Wechat official account. On this page, I will do signature verification or receive event messages, click to view Wechat-related documents.
1. Signature verification: when you modify the configuration, you need to use this address for signature verification.
2. Receive event messages: it means to push some messages when following, and to do some specific logical operations.
3) WeChat Pay configuration
Click WeChat Pay menu
WEIXIN_MCHID: merchant number, which can be found in the merchant information
WEIXIN_NOTIFY_URL: WeChat Pay's asynchronous callback API, which can be used to update order status, send push and other logic.
WEIXIN_KEY: to set this payment key, log in to the WeChat Pay merchant platform. After logging in, click to enter API Security, and then download the certificate and set your own key to OK.
II. Request and debugging
There is a convenient curl in php, and CURLOPT_SSL_VERIFYPEER is mentioned here. Without this attribute at the beginning, the data returned each time you request a Wechat server is false. After using the HttpRequester simulation request of firefox, you can return to the data and find that you want to set this property after looking up the information.
CURLOPT_SSL_VERIFYPEER: whether to detect whether the server's certificate is issued by an authorized CA authenticated by a regular browser
/ * *
* original POST
* @ param $url address of the url request
* @ param $raw raw data, which can be a string or an array
* @ return mixed returns 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
}
This is the end of the content of "how to understand the configuration and request of Wechat public platform development". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.