<?php
$data=call("https://www.liulinblog.com/kuaixun");
preg_match('/<h2 class=\"entry-title\"><a target=\"_blank\" href=\"(.*?)\"/',$data,$matchdata);
$data=call($matchdata[1]);
preg_match('/<\/a><\/p>(.*?)<\/div>/ism',$data,$json);
$json=strip_tags($json[1]);
echo $json;
function call($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36");
curl_setopt($curl,CURLOPT_TIMEOUT,5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
if($data)
return $data;
else
return false;
}
?>
本博客所有文章除特别声明外,均采用
CC BY-NC-SA 4.0
许可协议。转载请注明来自某个自留地 !
技术文章,学习了。
鸟叔来串门,通过虫洞穿梭至此,期待回访!