1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?php $url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; function CheckBaiduUrl($url){ $urls = array($url); $header = array ( "Host:www.baidu.com", "Content-Type: text/html;charset=utf-8", "Connection: keep-alive", 'Referer:https://www.baidu.com', 'Content-Encoding: gzip', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' ); $url = 'http://www.baidu.com/s?wd='.$url; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $rs=curl_exec($curl); curl_close($curl); $api = 'http://data.zz.baidu.com/urls?site=https://www.datehoer.com&token=XHWvdkaWTnFP9gyu'; $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode("\n", $urls), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); $ch = curl_init(); if(!strpos($rs,'提交网址')){
}else{ echo "<script>console.log('未收录')</script>"; curl_setopt_array($ch, $options); $result = curl_exec($ch); $file = fopen('info.text',"a+"); fwrite($file,$result.date("Y/m/d")); fwrite($file,"\r\n"); } } CheckBaiduUrl($url); ?>
|