聚合热搜热榜PHP接口API源码

#推荐
聚合热搜热榜PHP接口API源码

2026-03-17 2
[!--dianshu--] C币
VIP折扣
    折扣详情
  • 体验VIP会员

    免费

  • 月卡VIP会员

    免费

  • 年卡VIP会员

    免费

  • 永久VIP会员

    免费

查看演示
下载不了?请联系网站客服提交链接错误!
TAG标签: 安装指导

#推荐
聚合热搜热榜PHP接口API源码

2026-03-17 php教程 9999 2
郑重承诺丨总裁主题提供安全交易、信息保真!
TAG标签:
API源码
安装指导
[!--dianshu--] C币
VIP权限详情
    会员权限详情
  • 体验VIP会员

    免费

  • 月卡VIP会员

    免费

  • 年卡VIP会员

    免费

  • 永久VIP会员

    免费

开通VIP尊享优惠特权
立即下载 等待添加 升级会员 最新活动
微信扫码咨询 微信扫码咨询

联系电话:18888888888

进入TA的商铺 联系官方客服
详情介绍

欢迎!我白天是个邮递员,晚上就是个有抱负的演员。这是我的网站。我住在天朝的帝都,有条叫做Jack的狗。

API说明

聚合热搜热榜PHP接口API源码,本源码接口均抓取采集各大官网数据。

PHP环境为5.6或以上,解压压缩包里面的hotlist.php文件到网站目录

然后输入参数输入?type

参数内容;

zhihu(知乎热榜) weibo(微博热搜) baidu(百度热点) history(历史上的今天) bilihot(哔哩哔哩热搜) biliall(哔哩哔哩全站日榜) sspai(少数派头条) douyin(抖音热搜) CSDN(CSDN头条榜) 使用方法;

访问你的域名地址/hotlist.php?type=

?type=(输入参数才能显示内容)

示例;访问你的域名地址/hotlist.php?type=zhihu

API源码

<?phpheader("Access-Control-Allow-Origin:*");header("Content-type:application/json; charset=utf-8");date_default_timezone_set("Asia/Shanghai");class Api{  // 少数派 热榜  public function sspai()  {    $jsonRes = json_decode($this->Curl('https://sspai.com/api/v1/article/tag/page/get?limit=100000&tag=%E7%83%AD%E9%97%A8%E6%96%87%E7%AB%A0', null, null, "https://sspai.com"), true);    $tempArr = [];    foreach ($jsonRes['data'] as $k => $v) {      array_push($tempArr, [        'index' => $k +1,        'title' => $v['title'],        'createdAt' => date('Y-m-d', $v['released_time']),        'other' => $v['author']['nickname'],        'like_count' => $v['like_count'],        'comment_count' => $v['comment_count'],        'url' => 'https://sspai.com/post/'.$v['id'],        'mobilUrl' => 'https://sspai.com/post/'.$v['id']      ]);    }    return [      'success' => true,      'title' => '少数派',      'subtitle' => '热榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }    // CSDN 头条榜  public function csdn()  {    $_resHtml = $this->Curl('https://www.csdn.net', null, "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", "https://www.csdn.net");    preg_match('/window.__INITIAL_STATE__=(.*?);<\/script>/', $_resHtml, $_resHtmlArr);    $jsonRes = json_decode($_resHtmlArr[1],true);    $tempArr = [];    //头条    foreach ($jsonRes['pageData']['data']['Headimg'] as $k => $v) {      array_push($tempArr, [        'index' => $k +1,        'title' => $v['title'],        'url' => $v['url'],        'mobilUrl' => $v['url']      ]);    }    //头条1    foreach ($jsonRes['pageData']['data']['www-Headlines'] as $k => $v) {      array_push($tempArr, [        'index' => $k +17,        'title' => $v['title'],        'url' => $v['url'],        'mobilUrl' => $v['url']      ]);    }    //头条2    foreach ($jsonRes['pageData']['data']['www-headhot'] as $k => $v) {      array_push($tempArr, [        'index' => $k +48,        'title' => $v['title'],        'url' => $v['url'],        'mobilUrl' => $v['url']      ]);    }    return [      'success' => true,      'title' => 'CSDN',      'subtitle' => '头条榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }    //百度百科  历史上的今天  public function history()  {    $month=date('m',time() );    $day=date('d',time() );    //当前年月日    $today = date('Y年m月d日');    //获取接口数据    $jsonRes = json_decode($this->Curl('https://baike.baidu.com/cms/home/eventsOnHistory/'.$month.'.json', null, null, "https://baike.baidu.com"), true);    $tempArr = [];    //统计当日总数    $countnum = count($jsonRes[$month][$month.$day])-1;    foreach ($jsonRes[$month][$month.$day] as $k => $v) {      array_push($tempArr, [        'index' => $k +1,        'title' => $v['year'].'年-'.strip_tags($v['title']),        'url' => 'https://www.douyin.com/search/'.urlencode($v['title']),        'mobilUrl' => 'https://www.douyin.com/search/'.urlencode($v['title'])      ]);    }    return [      'success' => true,      'title' => '百度百科',      'subtitle' => '历史上的今天',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }    // 抖音 热搜榜  public function douyin()  {    $jsonRes = json_decode($this->Curl('https://www.iesdouyin.com/web/api/v2/hotsearch/billboard/word/', null, null, "https://www.douyin.com"), true);    $tempArr = [];    foreach ($jsonRes['word_list'] as $k => $v) {      array_push($tempArr, [        'index' => $k +1,        'title' => $v['word'],        'hot' => round($v['hot_value']/10000,1).'万',        'url' => 'https://www.douyin.com/search/'.urlencode($v['word']),        'mobilUrl' => 'https://www.douyin.com/search/'.urlencode($v['word'])      ]);    }    return [      'success' => true,      'title' => '抖音',      'subtitle' => '热搜榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }  // 哔哩哔哩 全站日榜  public function bilibili_rankall()  {    $jsonRes = json_decode($this->Curl('https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all', null, null, "https://www.bilibili.com"), true);    $tempArr = [];    foreach ($jsonRes['data']['list'] as $k => $v) {      array_push($tempArr, [        'index' => $k +1,        'title' => $v['title'],        'pic' => $v['pic'],        'desc' => $v['desc'],        'hot' => round($v['stat']['view']/10000,1).'万',        'url' => $v['short_link'],        'mobilUrl' => $v['short_link']      ]);    }    return [      'success' => true,      'title' => '哔哩哔哩',      'subtitle' => '全站日榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }  // 哔哩哔哩 热搜榜  public function bilibili_hot()  {    $jsonRes = json_decode($this->Curl('https://app.bilibili.com/x/v2/search/trending/ranking', null, null, "https://www.bilibili.com"), true);    $tempArr = [];    //return $jsonRes;    foreach ($jsonRes['data']['list'] as $k => $v) {      array_push($tempArr, [        'index' => $v['position'],        'title' => $v['keyword'],        'url' => 'https://search.bilibili.com/all?keyword='.$v['keyword'].'&order=click',        'mobilUrl' => 'https://search.bilibili.com/all?keyword='.$v['keyword'].'&order=click'      ]);    }    return [      'success' => true,      'title' => '哔哩哔哩',      'subtitle' => '热搜榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }    // 知乎热榜  热度  public function zhihuHot()  {    $jsonRes = json_decode($this->Curl('https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=50&desktop=true', null, null, "https://www.zhihu.com"), true);    $tempArr = [];    foreach ($jsonRes['data'] as $k => $v) {      preg_match('/\d+/',  $v['detail_text'], $hot);      array_push($tempArr, [        'index' => $k + 1,        'title' => $v['target']['title'],        'hot' => $hot[0].'万',        'url' => 'https://www.zhihu.com/question/'.urlencode($v['target']['id']),        'mobilUrl' => 'https://www.zhihu.com/question/'.urlencode($v['target']['id'])      ]);    }    return [      'success' => true,      'title' => '知乎热榜',      'subtitle' => '热度',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }  // 微博 热搜榜  public function wbresou()  {    $_md5 = md5(time());    $cookie = "Cookie: {$_md5}:FG=1";    $jsonRes = json_decode($this->Curl('https://weibo.com/ajax/side/hotSearch', null, $cookie, "https://s.weibo.com"), true);    $tempArr = [];    foreach ($jsonRes['data']['realtime'] as $k => $v) {      array_push($tempArr, [        'index' => $k + 1,        'title' => $v['note'],        'hot' => round($v['num']/10000,1).'万',        'url' => "https://s.weibo.com/weibo?q=".$v['note']."&Refer=index",        'mobilUrl' => "https://s.weibo.com/weibo?q=".$v['note']."&Refer=index"      ]);    }    return [      'success' => true,      'title' => '微博',      'subtitle' => '热搜榜',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }  // 百度热点 指数  public function baiduredian()  {    $_resHtml = str_replace(["\n", "\r", " "], '', $this->Curl('https://top.baidu.com/board?tab=realtime', null));    preg_match('/<!--s-data:(.*?)-->/', $_resHtml, $_resHtmlArr);    $jsonRes = json_decode($_resHtmlArr[1], true);    //return $jsonRes;    $tempArr = [];    foreach ($jsonRes['data']['cards'] as $v) {      foreach ($v['content'] as $k => $_v) {        array_push($tempArr, [          'index' => $k + 1,          'title' => $_v['word'],          'desc' => $_v['desc'],          'pic' => $_v['img'],          'url' => $_v['url'],          'hot' => round($_v['hotScore']/10000,1).'万',          'mobilUrl' => $_v['appUrl']        ]);      }    }    return [      'success' => true,      'title' => '百度热点',      'subtitle' => '指数',      'update_time' => date('Y-m-d h:i:s', time()),      'data' => $tempArr    ];  }  private function Curl($url, $header = [    "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",    "Accept-Encoding: gzip, deflate, br",    "Accept-Language: zh-CN,zh;q=0.9",    "Connection: keep-alive",    "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1"  ], $cookie = null, $refer = 'https://www.baidu.com')  {    $ip = rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255);    $header[] = "CLIENT-IP:" . $ip;    $header[] = "X-FORWARDED-FOR:" . $ip;    $ch = curl_init();    curl_setopt($ch, CURLOPT_URL, $url); //设置传输的 url    curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //发送 http 报头    curl_setopt($ch, CURLOPT_COOKIE, $cookie); //设置Cookie    curl_setopt($ch, CURLOPT_REFERER,  $refer); //设置Referer    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); // 解码压缩文件    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // 对认证证书来源的检查    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // 从证书中检查SSL加密算法是否存在    curl_setopt($ch, CURLOPT_TIMEOUT, 5); // 设置超时限制防止死循环    $output = curl_exec($ch);    curl_close($ch);    return $output;  }}$_type = isset($_GET['type']) ? $_GET['type'] : '';$API = new Api;switch ($_type) {  case 'baidu':    $_res = $API->baiduredian();    break;  case 'zhihu':    $_res = $API->zhihuHot();    break;  case 'weibo':    $_res = $API->wbresou();    break;  case 'bilihot':    $_res = $API->bilibili_hot();    break;  case 'biliall':    $_res = $API->bilibili_rankall();    break;  case 'douyin':    $_res = $API->douyin();    break;  case 'history':    $_res = $API->history();    break;  case 'csdn':    $_res = $API->csdn();    break;  case 'sspai':    $_res = $API->sspai();    break;  default:    $_res = ['success' => false, 'message' => '参数不完整'];    break;}$_res['copyright'] = '聚合热搜榜';exit(json_encode($_res,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT));?>

下载地址
  • 提取密码
  • 1561
  • 解压密码
  • DWQwdewq
    立即免费下载
    聚合热搜热榜PHP接口API源码
收藏 (15) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 ()

所有文章为演示数据,不提供下载地址,版权归原作者所有,仅提供演示效果!

CMS主题网 php教程 聚合热搜热榜PHP接口API源码 /showinfo-48-55-0.html

我们只做高端Wordpress主题开发!

常见问题
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情
  • 最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用
查看详情

相关文章

帝国CMS二次开发 函数文件      PRinterror()/e/class/connect.phpline 132query()/e/class/db_sql.php line 10fetch1()/e/class/db_sql.php line 30fetch()/e/class/db_sql.php line 22checklevel()/e/class/functions.php line 3414insert_dolog()/e/class/functions.php line 3...
#推荐
2026-03-17 14 C币
帝国CMS8.0父子信息调用方      帝国CMS8.0版新增父子信息功能,让一条信息也能成为一个信息、一个栏目、一个专题、甚至一个网站。本文共有四个部分:一、父子信息功能使用流程。二、调用子信息:可以用索引灵动标签调用。三、父子信息列表访问地址的语法说明。四、进阶:调用当前父子信息...
#推荐
2026-03-17 4 C币
帝国CMS判断当前数据库是      有时候我们需要判断数据库是否包含某字段,就可以使用下面这段SQL语法,$fr=$empire-&gt;fetch1(&quot;SELECT COUNT(*) AS column_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = &amp;#39;$infotb&amp;#39; AND COLUMN_NAME = &amp;#39;money&amp;#39;&quot;);if($fr[&amp;...
#推荐
2026-03-17 4 C币
Python开发一个ChatGPT GU      1、首先去下载这个ChatGPT库,用到的库是这个:https://github.com/acheong08/ChatGPT2、安装这个ChatGPT库:pip3 install revChatGPT==0.0.a423、同目录还需要一个“config.json”:{    &quot;session_token&quot;: &quot;&quot;,    &quot;cf_clearance&quot;: &quot;&quot;,    &quot;user_agent&quot;: &quot;
#推荐
2026-03-17 4 C币
使用CSS Grid Generator拖      如果你是CSS小白,不会使用复杂的UI框架,又需要开发一个响应式网站,那么我的站长站推荐你使用CSS Grid Generator,直接拖拽网格,就可以立即生成响应式CSS代码,复制到自己项目即可使用。使用方法1、首先根据你的项目需求,生成指定的列数和网格数量2、然后拖到...
#推荐
2026-03-17 3 C币
Playwright闲鱼智能监控机      项目介绍Playwright闲鱼智能监控机器人项目,基于 Playwright 和AI过滤分析的闲鱼多任务实时监控与智能分析工具,配备了功能完善的 Web 管理界面。可以实时按规则抓取闲鱼商品,垃圾佬的最爱。闲鱼智能监控机器人:https://github.com/dingyufei615/ai-goof...
#推荐
2026-03-17 3 C币
过年给网站加一对灯笼CSS      马上快过年了,给网站加一对红灯笼,这样才有过年的喜庆劲儿。灯笼是代码生成的无需图片,而且还会摆动。使用方法把HTML下面代码粘贴到网页BODY内任意位子都可以。灯笼的位子可以微调.deng-box的left和right数值。CSS代码&lt;!-- 灯笼代码 --&gt;&lt;div class=&quot;de...
#推荐
2026-03-17 3 C币
ajax上传文件进度条功能示      ajax上传文件时,有时比较耗时,需要在界面上显示下进度信息,获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数前端代码&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset=&quot;utf8&quot;&gt;&lt;title&gt;test upload&lt;/title&gt;&lt;!--jquery--&gt;&lt;script src=&quot;h...
#推荐
2026-03-17 3 C币