<?php
include "get_access_token.php";//access_token appid appsecret encodingAesKeys
function curls($url,$data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $id);
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$json=$output;
return $json;
}
//获取素材的列表,只能取永久素材的列表
echo $access_token;
//这里取到的$access_token绝对是对的
echo '<br>';
$url = "https://api.weixin.qq.com/cgi-bin/freepublish/batchget?access_token=$access_token";
$data='{
"offset":"0",
"count":"10",
"no_content":"0"
}';
$json=curls($url,$data);
var_dump($json);
//echo $json;
$obj = json_decode($json);
$article_id=$obj->{'article_id'}; // media_id
echo "操作结果:<br>";
echo "article_id".$article_id."<br>";
?>