|
- <?php
- //不加参数
- require_once '../Common/Config.php';
- require_once '../Common/Function.php';
- header("Content-type:text/html;charset=utf-8");
-
- $access_token=getAccesstoken();
- /*
- $result = httpRequest2('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxbe6da4af3e529e0c&secret=7c1b14020e87e9e213696e870da0e549');
- $token = (array)json_decode($result);
- $access_token =$token['access_token'];
- */
- $url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=".$access_token;
- $data='{"type":"image","offset":0,"count":20}';
-
- /*
- * 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
- *
- *
- */
-
- $result = http_request($url, $data);
- var_dump($result);
-
- function httpRequest2($url,$data=null){
- $ch=curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- if (!empty($data)){
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $output=curl_exec($ch);
- curl_close($ch);
- return $output;
- }
|