记录各搜索蜘蛛爬行记录php代码
记录各搜索蜘蛛爬行记录php代码,具体代码请看 a href=http://www.tongqiong.com/read.php?tid-109.html rel=nofollowhttp://www.tongqiong.com/read.php?tid-109.html/a
记录各搜索蜘蛛爬行记录php代码,具体代码请看
http://www.tongqiong.com/read.php?tid-109.html
<?php
//作者:http://www.tongqiong.com
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.tongqiong.com.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
//作者:http://www.tongqiong.com
?>
- 上一篇:通过淘宝IP接口查询客户端地址
- 下一篇:php分页类,第一次做
精彩图集
精彩文章






