Code example for WeChat store to call api and store to call api _ PHP Tutorial

Source: Internet
Author: User
Sample code for the store to call the api and the store to call the api. Sample code for the store to call the api. the store may encounter problems when calling the store api. The system always prompts systemerror. in the final analysis, it is still an example of the code used by the store to call the api.

You may encounter problems when calling the store api. The system always prompts system error. in the final analysis, the sent parameter is incorrect.

The following are several call examples:

The example is not completely written.

 AccessToken); $ ResData = cUrlRequest ($ url, '{"status":'. $ state. '}'); // note that this is in json format. Echo"
"; Print_r (json_decode ($ ResData);} // get all group functions getAllCategory ($ state = 0, $ token) {$ url =" https://api.weixin.qq.com/merchant/group/getall? Access_token = ". $ token; $ ResData = cUrlRequest ($ url, '{" status ":'. $ state. '}'); echo"
"; Print_r (json_decode ($ ResData);} // Obtain product information by group id function getProductByGroudid ($ state = 0, $ token) {$ url =" https://api.weixin.qq.com/merchant/group/getbyid? Access_token = ". $ token; $ ResData = cUrlRequest ($ url, '{" group_id ":'. $ state. '}'); echo"
"; Print_r (json_decode ($ ResData);} // Obtain the accesstoken function getAccessToken () {$ appid =" your appid "; $ appsecret =" your appsecret "; $ url = "https://api.weixin.qq.com/cgi-bin/token? Grant_type = client_credential & appid = ". $ appid. "& secret = ". $ appsecret; $ result = cUrlRequest ($ url); $ jsoninfo = json_decode ($ result, true); $ access_token = $ jsoninfo ["access_token"]; return $ access_token ;} // get a single item function getOneProductByid ($ state = 0, $ token) {$ url = "https://api.weixin.qq.com/merchant/get? Access_token = ". $ token; $ ResData = cUrlRequest ($ url, '{" product_id ":"'. $ state. '""}'); echo"
";             print_r( json_decode($ResData) );        }                        $AccessToken=getAccessToken();         //gStateProduct(1,$AccessToken);                //getAllCategory(1,$AccessToken);        //getProductByGroudid(207061749,$AccessToken);        getOneProductByid("pf82VwN45zr8eOlur5mAiSTjg8WU",$AccessToken);

When Xiaoming first called the store api, you may encounter problems. The system always prompts system error. in the final analysis, it still sends...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.