lelemi 发表于 2007 年 5 月 5 日 17:20:03

记录蜘蛛爬行的代码 ASP

先建立一个 robots 文件夹
<%
Sub robot()
      Dim robots:robots="Baiduspider+@Baidu|Googlebot@Google|ia_archiver@Alexa|IAArchiver@Alexa|ASPSeek@ASPSeek|YahooSeeker@Yahoo|sohu-search@Sohu|help.yahoo.com/help/us/ysearch/slurp@Yahoo|sohu-search@SOHU|MSNBOT@MSN"
      dim I1,I2,l1,l2,l3,i,rs
      l2=false
      l1=request.servervariables("http_user_agent")
      F1=request.ServerVariables("SCRIPT_NAME")
      I1=split(robots,chr(124))
      for i=0 to ubound(I1)
                I2=split(I1(i),"@")
                if instr(lcase(l1),lcase(I2(0)))>0 then
                        l2=true:l3=I2(1):exit for
                end if
      next
      if l2 and len(l3)>0 then'如果是爬虫,就更新爬虫信息
                FilePath = Server.Mappath("robots/"&l3&"_robots.txt")
                '记录蜘蛛爬行
                Set Fso = Server.CreateObject("Scripting.FileSystemObject")
                Set Fout = Fso.OpenTextFile(FilePath,8,True)
                              Fout.WriteLine "索引页面:"&F1
                              Fout.WriteLine "蜘蛛:"&l3&chr(32)&chr(32)&"更新时间:"&Now()
                              Fout.WriteLine "-----------------------------------------------"
                              Fout.Close
                Set Fout = Nothing
                Set Fso = Nothing
      end if
end Sub
%>

lelemi 发表于 2007 年 5 月 5 日 17:26:46

1:空间需要支持ASP;
2:把文件上传到根目录;
3:在你所需要监测的页里插入调用的代码:<!--#include file = "rob.asp"--> 然后保存为*.asp
如:
<html>
……
<!--#include file = "rob.asp"-->
</body>
</html>
4:文件spider.asp可查看蜘蛛来路!

[ 本帖最后由 lelemi 于 2007-5-5 17:28 编辑 ]

lelemi 发表于 2007 年 5 月 5 日 17:28:43

http://www.softhy.net/down.asp?id=9719&no=1

nolai 发表于 2007 年 5 月 5 日 17:32:07

怎么不给个演示看看?

y 发表于 2007 年 5 月 5 日 17:57:27

去掉yahoo吧,yahoo一次要出动几百个蜘蛛,文件记录的话。。。

y 发表于 2007 年 5 月 5 日 17:58:26

顺便,这文件一旦被利用着CC,效果会狠爽的。。

java 发表于 2007 年 5 月 5 日 18:02:04

回复 #6 y 的帖子

宝宝你虾米时间又研究ASP了?

y 发表于 2007 年 5 月 5 日 18:04:24

原帖由 hsphere 于 2007-5-5 18:02 发表 http://www.jgwy.net/bbs/images/common/back.gif
宝宝你虾米时间又研究ASP了?
:@ 猜的。。。。

java 发表于 2007 年 5 月 5 日 18:41:38

yahoo最多出动了4000多只,结果把我service unvalible了

waitme 发表于 2007 年 5 月 5 日 19:29:25

回复 #9 hsphere 的帖子

;P ;P ;P
垃圾服务器。。。。。。。
页: [1]
查看完整版本: 记录蜘蛛爬行的代码 ASP