<?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
许可协议。转载请注明来自淼先森自留地 !
评论
评论
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /www/wwwroot/www.miaoxiansen.cn/var/Typecho/Db/Adapter/Pdo.php on line 108