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>
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>
相关文章推荐
- Java学习备忘 (一)之二
- iBeacon参考网址
- 插件的用法和实现
- 第三讲 进程地址空间
- 小小君的OC--类之间的复合调用
- codeforces 591B Rebranding
- 编程思想之多线程与多进程(2)-线程优先级与线程安全
- takePic and Videos
- Dijkstra算法和Floyd算法
- Oracle函数之Grouping/Grouping_id
- Codeforces Gym 100792K King's Rout(优先队列+拓扑排序)
- iOS开发 关于iBeacon的一些记录
- 链表
- 浏览器打开就是全屏的代码说明
- php读取邮件
- 【UI】android如何绘制一个饼图
- iOS中UIView翻转效果实现
- DLL中的main函数
- 图像处理(二)laplacian锐化
- Java - 继承(基础)