<?php
date_default_timezone_set ("PRC");//设置时区
set_time_limit(0);
header('Access-Control-Allow-Origin:*');//允许所有来源访问
header('Access-Control-Allow-Method:POST,GET');//允许访问的方式
header("Content-type:text/html;charset=utf-8");
// 请求示例 url 默认请求参数已经URL编码处理
$method = "GET";
$url = "https://search.bilibili.com/all?keyword=Micropython&from_source=webtop_search&order=pubdate";
$curl= "https://search.bilibili.com/";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
//伪造来源地址
curl_setopt ($curl, CURLOPT_REFERER, $refer);
//var_dump(curl_exec($curl));
//exit;
//echo curl_exec($curl);
$con= curl_exec($curl);
$pattern = '/\/\/www.bilibili.com\/video\/[\s\S]*?\?from=search/i';
preg_match_all($pattern, $con, $links);
var_dump($links);
exit;
$links = array_flip(array_flip($links[1]));
var_dump($links);
?>
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询