您的位置:首页 > 其它

wechat开发用户接口(未完成)

2015-10-28 21:04 357 查看
<span style="font-size:18px;"><span style="font-family:KaiTi_GB2312;"><?php
header('Content-Type: text/html; charset=UTF-8');

<span style="color:#33cc00;background-color: rgb(255, 255, 255);">/*获取 ACCESS_TOKEN*/</span>
$APPID="Your APPID";
$APPSECRET="Your APPSECRET";
$TOKEN_URL="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$APPID."&secret=".$APPSECRET;
$json=file_get_contents($TOKEN_URL);
$result=json_decode($json);
$ACCESS_TOKEN=$result->access_token;
<span style="color:#33cc00;">/*数据*/</span>
$data = '{"group":{"name":"1506"}}';
<span style="color:#33cc00;">/*接口*/</span>
$api = "https://api.weixin.qq.com/cgi-bin/groups/create?access_token=$ACCESS_TOKEN";
<span style="color:#33cc00;">/*发送数据*/</span>
$ch = curl_init($MENU_URL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");<span style="color:#009900;">//指定POST传输</span>
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); <span style="color:#009900;">//指定数据</span>
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); <span style="color:#009900;">//获取返回的文本流</span>
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data)));
$info = curl_exec($ch);</span>
</span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: