You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.2 KiB

  1. <?php
  2. //不加参数
  3. require_once '../Common/Config.php';
  4. require_once '../Common/Function.php';
  5. header("Content-type:text/html;charset=utf-8");
  6. $access_token=getAccesstoken();
  7. /*
  8. $result = httpRequest2('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxbe6da4af3e529e0c&secret=7c1b14020e87e9e213696e870da0e549');
  9. $token = (array)json_decode($result);
  10. $access_token =$token['access_token'];
  11. */
  12. $url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=".$access_token;
  13. $data='{"type":"image","offset":0,"count":20}';
  14. /*
  15. * 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
  16. *
  17. *
  18. */
  19. $result = http_request($url, $data);
  20. var_dump($result);
  21. function httpRequest2($url,$data=null){
  22. $ch=curl_init();
  23. curl_setopt($ch, CURLOPT_URL, $url);
  24. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  26. if (!empty($data)){
  27. curl_setopt($ch, CURLOPT_POST, 1);
  28. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  29. }
  30. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  31. $output=curl_exec($ch);
  32. curl_close($ch);
  33. return $output;
  34. }