用appid和appsecert获得access token,接口为
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
程序实现如下
$appid = "";
$appsecret = "";
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";
$ch = curl_init(,',',');
curl_setopt($ch, CURLOPT_URL, $url,',',');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE,',',');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE,',',');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1,',',');
$output = curl_exec($ch,',',');
curl_close($ch,',',');
$jsoninfo = json_decode($output, true,',',');
$access_token = $jsoninfo["access_token"];
关键字词: