|
本帖最后由 jiteloozz 于 2022-8-1 10:29 编辑
根据实例一的方法,如法炮制,得到post接口
https://www.ixigua.com/api/cinema/filterv2/albums
@xjn147 你要的电影ID获取。
西瓜视频电影列表DEMO.PHP,回复可见:
<?php
$id = $_GET['id'] ? $_GET['id'] : '';
if($id==''){
$bstrURL = 'https://www.ixigua.com/api/cinema/filterv2/albums';
for($i=0;$i<10;$i++){
$post='{"pinyin":"dianying","filters":{"tag":"全部类型","area":"全部地区","type":"电影","sort":"综合排序","paid":"全部资费"},"offset":'.($i*18).',"limit":17}';
$data =get_data($bstrURL,$post);
$json=json_decode($data);
foreach ($json->data->albumList as $va){
$id=$va->albumId;
$name=$va->title;
$tag=$va->tagList[0];
echo $name.',http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?id='.$id.'&tag='.$tag.'</a><br>';
}
}
}
function get_data($url,$post){
$headers=array(
'content-type: application/json',
'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
'referer:https://www.ixigua.com/cinema/filter/dianying/',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
代码段还有不足,若大神有更好方案,欢迎指正~~~
发帖注意事项
请勿胡乱发帖:https://www.right.com.cn/forum/thread-8307840-1-1.html
账户手机验证:https://www.right.com.cn/forum/home.php?mod=spacecp&ac=plugin&id=jzsjiale_sms:home
|
|