记录蜘蛛爬行的代码 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
%>



文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 2 | 引用: 334 | 查看次数: -
非人类[2008-07-15 12:26 AM | del]
先复制上面的代码 建一个asp文件

然后再在你要记录的文件那里包含这个文件
<!--include file="你建的asp文件名" -->
Joem[2008-07-15 11:28 AM | del]
博主能不能指导一下具体要如何加代码?加在哪里啊?
谢谢!
mail:19928866@qq.com
QQ:19928866
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.