Configuration and request of public platform development, public platform
First, configuration parameters
Define (' Weixin_appid ', ' wxzzzzzzzz ');d efine (' Weixin_appsecret ', ' Ouewjdsaudsamkh ');d efine (' Weixin_token ', ' 9973833232232 ');d efine (' Weixin_notify_url ', ' http://xx.com/xx/xx ');d efine (' Weixin_mchid ', ' 322221121 ');d efine (' Weixin_key ', ' xddsdswewew ');
1) ID in the development of the public number
weixin_appid: App ID
Weixin_appsecret: App key
Go to the Public Platform homepage, click on the developer center, impressively can see, configuration page, these two default is some.
2) Server Configuration
Weixin_token, which is the token token, is custom and must be English or numeric, with a length of 3-32 characters.
URL server address, also say the public number of the entry address. On this page, I will do signature verification or receive event messages and click to view related documents.
1, Signature verification: As a modification of the configuration, it is necessary to do this address signature verification
2, receive the event message: refers to when the attention of the time to push some messages come over, and can do some specific logic operation
3) Payment Configuration
Click on the Payment menu
Weixin_mchid: Merchant number, can be found in the merchant information
Weixin_notify_url: Payment asynchronous Callback API, can do update order status, send push and other logic
Weixin_key: Set this payment key to login to pay the merchant platform, login and click into the API security, then download the certificate and set the key yourself, OK.
Second, request and debugging
There is a very handy curl in PHP, and here's the Curlopt_ssl_verifypeer. This property was not added at first, and the data returned is false every time the server is requested. After the use of Firefox httprequester simulation request, you can return to the data, find the data and found to set this property.
Curlopt_ssl_verifypeer: Whether to detect whether the server's certificate is issued by an authorized CA that is certified by a formal browser
/**
* Original post
* @param the URL address of the $url request
* @param $raw raw data, can be a string or an array
* @return Mixed return request 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;
}
It is recommended that the httprequester, this plugin, can simulate post, get and other submissions, content type can also be selected.
Development also provides a place to test interfaces online. Click to view the Public platform Interface debugging tool.
When debugging is requested, various return codes are returned. Click to view the global return code description.
http://www.bkjia.com/PHPjc/1049123.html www.bkjia.com true http://www.bkjia.com/PHPjc/1049123.html techarticle configuration and request of public platform development, public platform one, configuration parameters define (' Weixin_appid ', ' wxzzzzzzzz ');d efine (' Weixin_appsecret ', ' ouewjdsaudsamkh '); Define (' Weixin ...