很多朋友没有自己的服务器,有些虚拟空间服务提供商,也没有开启IIS日志功能,SEOer们如果不能每天看到自己的IIS日志,对每天蜘蛛的来访不知情的话,也不能更好的优化这个网站了,所有SEO海军在此为大家找了两段PHP与ASP 蜘蛛来访统计代码.
ASP版蜘蛛统计代码:
<%
Sub robot()
Dim robots:robots="Baiduspider+@Baidu|Googlebot@Google|ia_archiver
@Alexa|IAArchiver@Alexa|ASPSeek@ASPSeek|YahooSeeker@Yahoo|
sohusearch@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")
字串3
'记录蜘蛛爬行
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
%>