想写一个获取qq群公告列表的接口,代码如下
$skey=$_REQUEST["skey"];
$uin=$_REQUEST["uin"];
$pskey=$_REQUEST["pskey"];
$group=$_REQUEST["group"];
$url="https://qun.qq.com/cgi-bin/feeds/get_list";
$header=array("Cookie: p_uin=o".$uin."; p_skey=".$pskey."; uin=o".$uin."; skey=".$skey."; ");
$data='qid='.$group.'&i=1&n=999999999&s=-1';
$curl=curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
curl_setopt($curl,CURLOPT_TIMEOUT,30);
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,FALSE);
$return=curl_exec($curl);
curl_close($curl);
$json=json_decode($return,true);
print_r($json);
返回的数据如下
Array
(
[ec] => 0
[feeds] => Array
(
[0] => Array
(
[cn] => 0
[fid] => 9d09a53f00000000e62e0661acc50a00
[fn] => 0
[msg] => Array
(
[text] => 测试
[text_face] => 测试
[title] => 群公告
)
[pubt] => 1627795174
[type] => 6
[u] => 2707617427
[vn] => 0
)
[1] => Array
(
[cn] => 0
[fid] => 9d09a53f000000006f5605617b110300
[fn] => 0
[msg] => Array
(
[text] => 123
[text_face] => 123
[title] => 群公告
)
[pubt] => 1627739759
[type] => 6
[u] => 2707617427
[vn] => 0
)
[2] => Array
(
[cn] => 0
[fid] => 9d09a53f0000000075050561f4710200
[fn] => 0
[msg] => Array
(
[text] => 测试
[text_face] => 测试
[title] => 群公告
)
[pubt] => 1627719029
[type] => 6
[u] => 2707617427
[vn] => 0
)
[3] => Array
(
[cn] => 0
[fid] => 9d09a53f0000000000b20461f5430c00
[fn] => 0
[msg] => Array
(
[text] => 测试
[text_face] => 测试
[title] => 群公告
)
[pubt] => 1627697664
[type] => 6
[u] => 2707617427
[vn] => 0
)
>
)
[gln] => 6
[gsi] => BBMh4R53mnx2ziOXcNmXzI8epAZ-27IAajj9VEiHj9NZTSSp-n_TmnWa4K2bVtzduQNqaIjnP_o52iCVRwcKgQ@@
[pv] => 0
[svrt] => 1627802092
[tst] => 10
[ui] => Array
(
[2113224879] => Array
(
[f] => http://thirdqq.qlogo.cn/g?b=sdk&k=kkQMqE0cobpYQFy0diaUiaicw&s=40&t=1598403951
[n] => 空白
)
[2707617427] => Array
(
[f] => http://thirdqq.qlogo.cn/g?b=sdk&k=SdqkjAk1GJxwutickSoiaY9w&s=40&t=1591501875
[n] => ???
)
)
)
该如何将获取到的json输出成这个样子:
公告1
内容:测试
账号:2707617427
公告id:json里的fid
公告2
内容:测试
账号:2707617427
公告id:json里的fid
这样类推下去