php获取各搜索蜘蛛爬行记录的代码
发布时间:2016-09-03 编辑:jiaochengji.com
本文介绍下,用php实现的获取各大搜索蜘蛛的爬行记录的一段代码,有需要的朋友参考下。
支持如下的搜索引擎:Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行网站的记录!
代码:
<?php /** * 获取搜索引擎爬行记录 * edit by www.jbxue.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.jbxue.com.txt"; $time=nowtime(); $data=fopen($file,"a"); fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n"); fclose($data); } ?>
您可能感兴趣的文章:
php获取各搜索蜘蛛爬行记录的代码
php记录蜘蛛爬行历史的实现代码
php记录搜索引擎关键词的代码示例
搜索引擎蜘蛛爬行统计分析
分析apache日志中蜘蛛爬行记录数量的shell脚本(图文)
GOOGLE 工作原理分析
php 抓取蜘蛛爬虫痕迹的代码分享
python的爬虫是什么意思
通过PHP程序知道蜘蛛是否访问你的网站(附代码)
怎么让百度快速收录新网站
[关闭]