Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->网络应用 ->搜索引擎优化SEO ->正文

记录蜘蛛爬行ASP代码

来源:Linuxdby.com 作者:Webmaster 时间:2007-04-12 点击: [收藏] [投稿]
先建立一个 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)&"更新时间:"&**()
Fout.WriteLine "-----------------------------------------------"
Fout.Close
Set Fout = Nothing
Set Fso = Nothing
end if
end Sub
%>
asp 放在公用的函数文件里面
比如 放在conn.asp里面 然后直接在 下面调用过程就行了

Call robot()

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:Google PR劫持   下一篇:掌握六点,一个月进搜索引擎排名前十(SEO实战经验)

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号