首页 > 上网技巧 > 电脑小技巧 > PHP获取微信公众号永久素材列表

PHP获取微信公众号永久素材列表

时间:2019-05-07 09:48 作者:QQ地带 我要评论

<?php
 
/*  获取永久元素列表  */
header("Content-Type: text/html; charset=utf-8");
$token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$url = 'https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token='.$token;
$josn = '{"type":"image","offset":"0","count":"20"}';
$data = json_decode(https_request($url,$josn));
print_r($data);
 
function https_request($url, $data = null)
{
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    if (!empty($data)){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($curl);
    curl_close($curl);
    return $output;
}

标签: php
顶一下
(0)
0%
踩一下
(0)
0%

Google提供的广告