: This article mainly introduces the code example for calling the api in the store. if you are interested in the PHP Tutorial, refer to it. 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);
The above describes the code example for the store to call the api, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.