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

yipeiwu_com6年前PHP代码库
那么下面分享一款用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.jb51.net.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
////www.jb51.net收集整理
?>

相关文章

php使用CURL不依赖COOKIEJAR获取COOKIE的方法

本文实例讲述了php使用CURL不依赖COOKIEJAR获取COOKIE的方法。分享给大家供大家参考。具体分析如下: PHP中CURL类是一个非常牛逼的工具类,具体怎么牛逼就不啰嗦了。...

php GD绘制24小时柱状图

80,250,430,134,35,60,233,90,263,225,120,59,151,677,340,221,550,300,229,97,230,123,133,87 ...

解析PHP留言本模块主要功能的函数说明(代码可实现)

一,敏感词处理1,过滤敏感词preg_match()函数用来在字符串中搜索所有与给定的正则表达式匹配的内容,如果存在则返回True,否则返回False。语法:int preg_match...

PHP正则匹配操作简单示例【preg_match_all应用】

本文实例讲述了PHP正则匹配操作。分享给大家供大家参考,具体如下: <?php $str = <<< EOT <a href="...

PHP完全二叉树定义与实现方法示例

PHP完全二叉树定义与实现方法示例

本文实例讲述了PHP完全二叉树定义与实现方法。分享给大家供大家参考,具体如下: 若设二叉树的深度为h,除第 h 层外,其它各层 (1~h-1) 的结点数都达到最大个数,第 h 层所有的结...