PHP寫的獲取各搜索蜘蛛爬行記錄代碼
更新時(shí)間:2012年08月21日 20:49:31 作者:
做為站長每天都想知道自己的網(wǎng)站百度蜘蛛等搜索引擎爬蟲是否了網(wǎng)站 來抓取文章,一般站長不知道怎么搞用工具查詢,也可以查看空間里的日志,但是空間里的日志的記錄全是代碼你不知道那個(gè)是搜索引擎爬蟲的來路
那么下面分享一款用php寫的獲取各搜索蜘蛛爬行記錄代碼
支持搜索引擎如下
可以記錄Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行網(wǎng)站的記錄!
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.dbjr.com.cn.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
//http://www.dbjr.com.cn收集整理
?>
支持搜索引擎如下
可以記錄Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行網(wǎng)站的記錄!
php代碼如下
復(fù)制代碼 代碼如下:
<?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.dbjr.com.cn.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
//http://www.dbjr.com.cn收集整理
?>
您可能感興趣的文章:
- php+ajax做仿百度搜索下拉自動提示框(有實(shí)例)
- php 搜索框提示(自動完成)實(shí)例代碼
- jquery+php實(shí)現(xiàn)搜索框自動提示
- 利用PHP+JS實(shí)現(xiàn)搜索自動提示(實(shí)例)
- 谷歌音樂搜索欄的提示功能php修正代碼
- PHP 搜索查詢功能實(shí)現(xiàn)
- php站內(nèi)搜索并高亮顯示關(guān)鍵字的實(shí)現(xiàn)代碼
- PHP獲取搜索引擎關(guān)鍵字來源的函數(shù)(支持百度和谷歌等搜索引擎)
- php使用正則表達(dá)式進(jìn)行字符串搜索的方法
- PHP+JS實(shí)現(xiàn)的實(shí)時(shí)搜索提示功能
相關(guān)文章
PHP在字符斷點(diǎn)處截?cái)辔淖值膶?shí)現(xiàn)代碼
所謂斷字 (word break),即一個(gè)單詞可在轉(zhuǎn)行時(shí)斷開的地方。這一函數(shù)將在斷字處截?cái)嘧址?/div> 2011-04-04PHP基于pdo的數(shù)據(jù)庫操作類【可支持mysql、sqlserver及oracle】
這篇文章主要介紹了PHP基于pdo的數(shù)據(jù)庫操作類,可實(shí)現(xiàn)基本的數(shù)據(jù)庫連接、增刪改查、關(guān)閉連接等操作,還支持針對mysql、sqlserver及oracle等數(shù)據(jù)庫的操作,需要的朋友可以參考下2018-05-05PHP自定義函數(shù)判斷是否為Get、Post及Ajax提交的方法
這篇文章主要介紹了PHP自定義函數(shù)判斷是否為Get、Post及Ajax提交的方法,涉及php服務(wù)器預(yù)定義變量$_SERVER及字符串相關(guān)操作技巧,需要的朋友可以參考下2017-07-07PHP實(shí)現(xiàn)文件分片上傳的實(shí)例代碼
在本篇文章里小編給大家整理的是一篇關(guān)于PHP實(shí)現(xiàn)文件分片上傳的實(shí)例代碼內(nèi)容,有興趣的朋友們參考學(xué)習(xí)下。2020-01-01最新評論