PHP写的获取各搜索蜘蛛爬行记录代码

前端之家收集整理的这篇文章主要介绍了PHP写的获取各搜索蜘蛛爬行记录代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

那么下面分享一款用PHP写的获取搜索蜘蛛爬行记录代码
支持搜索引擎如下
可以记录Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行网站的记录!
PHP代码如下
<div class="codetitle"><a style="CURSOR: pointer" data="25530" class="copybut" id="copybut25530" onclick="doCopy('code25530')"> 代码如下:

<div class="codebody" id="code25530">
<?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.jb51.cc.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
////www.jb51.cc收集整理
?>

原文链接:https://www.f2er.com/php/27047.html

猜你在找的PHP相关文章