记录蜘蛛爬行日志代码(PHP)

Share on:

记录蜘蛛爬行的日志格式如下:

爬行的时间,蜘蛛(搜索引擎机器人)类型,爬行目标页面,来自哪里

Time:2011-6-17 21:34:06 robot:Baiduspider pageURL:http://fanhefan.4430.0-168.com/index.php preUrl: URL:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)

Time:2011-6-18 17:45:16 robot:Googlebot pageURL:http://fanhefan.4430.0-168.com/index.php?paged=4 preUrl: URL:Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

代码如下:

将include放到网站入口处,一般在INDEX.PHP中,请在相同目录下新建一个名为googlebot.txt的文档。

闽ICP备12003472号-7