PHP寫的獲取各搜索蜘蛛爬行記錄代碼
更新時間:2012年08月21日 20:49:31 作者:
做為站長每天都想知道自己的網站百度蜘蛛等搜索引擎爬蟲是否了網站 來抓取文章,一般站長不知道怎么搞用工具查詢,也可以查看空間里的日志,但是空間里的日志的記錄全是代碼你不知道那個是搜索引擎爬蟲的來路
那么下面分享一款用php寫的獲取各搜索蜘蛛爬行記錄代碼
支持搜索引擎如下
可以記錄Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行網站的記錄!
php代碼如下
<?php
function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'googlebot') !== false){
return 'Google';
}
if (strpos($useragent, 'baiduspider') !== false){
return 'Baidu';
}
if (strpos($useragent, 'msnbot') !== false){
return 'Bing';
}
if (strpos($useragent, 'slurp') !== false){
return 'Yahoo';
}
if (strpos($useragent, 'sosospider') !== false){
return 'Soso';
}
if (strpos($useragent, 'sogou spider') !== false){
return 'Sogou';
}
if (strpos($useragent, 'yodaobot') !== false){
return 'Yodao';
}
return false;
}
function nowtime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
$searchbot = get_naps_bot();
if ($searchbot) {
$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
$url=$_SERVER['HTTP_REFERER'];
$file="www.dhdzp.com.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
//http://www.dhdzp.com收集整理
?>
支持搜索引擎如下
可以記錄Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行網站的記錄!
php代碼如下
復制代碼 代碼如下:
<?php
function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'googlebot') !== false){
return 'Google';
}
if (strpos($useragent, 'baiduspider') !== false){
return 'Baidu';
}
if (strpos($useragent, 'msnbot') !== false){
return 'Bing';
}
if (strpos($useragent, 'slurp') !== false){
return 'Yahoo';
}
if (strpos($useragent, 'sosospider') !== false){
return 'Soso';
}
if (strpos($useragent, 'sogou spider') !== false){
return 'Sogou';
}
if (strpos($useragent, 'yodaobot') !== false){
return 'Yodao';
}
return false;
}
function nowtime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
$searchbot = get_naps_bot();
if ($searchbot) {
$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
$url=$_SERVER['HTTP_REFERER'];
$file="www.dhdzp.com.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
//http://www.dhdzp.com收集整理
?>
相關文章
php+javascript實現(xiàn)的動態(tài)顯示服務器運行程序進度條功能示例
這篇文章主要介紹了php+javascript實現(xiàn)的動態(tài)顯示服務器運行程序進度條功能,涉及php結合javascript數(shù)學運算與緩沖輸出相關操作技巧,需要的朋友可以參考下2017-08-08
phpmyadmin配置文件現(xiàn)在需要絕密的短密碼(blowfish_secret)的2種解決方法
安裝完成phpmyadmin之后,再在瀏覽器里輸入:http://localhost/phpmyadmin這時能看到phpmyadmin的管理頁面,不過會提示:“配置文件現(xiàn)在需要絕密的短密碼(blowfish_secret)?!?/div> 2014-05-05
使用Canal實現(xiàn)PHP應用程序與MySQL數(shù)據(jù)庫的實時數(shù)據(jù)同步
Canal是阿里巴巴開源的一個數(shù)據(jù)同步工具,可實現(xiàn)MySQL數(shù)據(jù)庫到其他數(shù)據(jù)源的實時同步,PHP應用程序中可輕松使用,提高系統(tǒng)的可靠性和實時性,提供了豐富的API和文檔支持2023-04-04
PHP實現(xiàn)二維數(shù)組(或多維數(shù)組)轉換成一維數(shù)組的常見方法總結
這篇文章主要介紹了PHP實現(xiàn)二維數(shù)組(或多維數(shù)組)轉換成一維數(shù)組的常見方法,結合實例形式總結分析了PHP數(shù)組遍歷、轉換所涉及的array_reduce、array_walk_recursive及array_map函數(shù)常見使用技巧,需要的朋友可以參考下2019-12-12
使用PHP會話(Session)實現(xiàn)用戶登陸功能
本篇文章是對PHP會話(Session)實現(xiàn)用戶登陸功能進行了詳細的分析介紹,需要的朋友參考下2013-06-06最新評論

