可以查询google排名的asp源码

2018-09-06 11:05

阅读:642

  以下是源码,请命名为.ASP文件.

复制代码 代码如下:
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<%
ifrequest(action)=1then
word=request(word)
url=request(url)
ifword<>then
getCategories()

ifurl<>then
getCategories2()
endif
endif
endif

FunctiongetCategories()

response.write(<b>&word&关键词在Google搜索排名中,前10位网站!</b><br>)

onerrorresumenext
DimoXMLHTTP
DimoCategories
DimBodyText
DimPos,Pos1
SetoXMLHTTP=CreateObject(Microsoft.XMLHTTP)
http=
oXMLHTTP.openGET,http,False
oXMLHTTP.send

BodyText=oXMLHTTP.responsebody
BodyText=BytesToBstr(BodyText,UTF-8)
Pos=Instr(BodyText,<body)
pos1=Instr(BodyText,</body>)
BodyText=mid(BodyText,pos,pos1)

Pos=Instr(BodyText,<div>)
BodyText=Mid(BodyText,Pos)
pos1=Instr(BodyText,</div>)
BodyText=mid(BodyText,1,pos1)
response.write(::::&BodyText&::::)

BodyText=split(BodyText,<pclass=g>)

fori=1to10
Pos=Instr(BodyText(i),</a>)
thet=Mid(BodyText(i),1,Pos+3)

Pos=Instr(BodyText(i),<spandir=ltr>)
theu=Mid(BodyText(i),Pos)
pos1=Instr(theu,</span>)
theu=mid(theu,1,pos1-1)

response.write(T:&thet&<br>)
response.write(U:&theU&<br><hr>)

next

SetoXMLHTTP=Nothing
iferr.number<>0then
response.write出错了,错误描述:&err.description&<br>错误来源&err.source
response.End()
endif
EndFunction


FunctiongetCategories2()
onerrorresumenext
DimoXMLHTTPAsObject
DimoCategoriesAsObject
DimBodyText
DimPos,Pos1
SetoXMLHTTP=CreateObject(Microsoft.XMLHTTP)

out=0
start=0
pp=0
dowhile(true)

strurl=
response.write(strurl&<br>)

oXMLHTTP.openGET,strurl,False
oXMLHTTP.send

BodyText=oXMLHTTP.responsebody
BodyText=BytesToBstr(BodyText,gb2312)
Pos=Instr(BodyText,<body)
pos1=Instr(BodyText,</body>)
BodyText=mid(BodyText,pos,pos1)


Pos=Instr(BodyText,<div>)
BodyText=Mid(BodyText,Pos)
pos1=Instr(BodyText,</div>)
BodyText=mid(BodyText,1,pos1)
response.write(::::&BodyText&::::)

BodyText=split(BodyText,<pclass=g>)

fori=1to10
Pos=Instr(BodyText(i),<spandir=ltr>)
theu=Mid(BodyText(i),Pos)
pos1=Instr(theu,</span>)
theu=mid(theu,1,pos1-1)
response.write(theu)

Pos3=Instr(theu,url)
ifPos3>0then
pp=start+i
out=1
ExitFor
endif
next

ifout=1orstart=90then
exitdo
endif

start=cint(start)+10
loop
ifpp<>0then
response.write(<br><br>网站<b>&url&</b>在搜索关键词<b>&word&</b>时在Google中排名名次第<b>&pp&</b>位)
else
response.write(<br><br>网站<b>&url&</b>在搜索关键词<b>&word&</b>时在Google中排名名次<fontcolor=red>未在前100名内</font>)
endif


SetoXMLHTTP=Nothing
iferr.number<>0then
response.write出错了,错误描述:&err.description&<br>错误来源&err.source
response.End()
endif

EndFunction

FunctionBytesToBstr(body,Cset)
dimobjstream
setobjstream=Server.CreateObject(adodb.stream)
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction
PublicFunctionHTMLEncode(fString)
IfNotIsNull(fString)Then
fString=replace(fString,>,>)
fString=replace(fString,<,<)
fString=Replace(fString,CHR(32),)
fString=Replace(fString,CHR(9),)
fString=Replace(fString,CHR(34),")
fString=Replace(fString,CHR(39),')单引号过滤
fString=Replace(fString,CHR(13),)
fString=Replace(fString,CHR(10)&CHR(10),</P><P>)
fString=Replace(fString,CHR(10),<BR>)
HTMLEncode=fString
EndIf
EndFunction




%>
<title>关键字,网站在Google中排名查询</title>
<hr><hr><b>
关键字,网站在Google中排名查询:
<formname=form1method=postaction=?action=1>
网址:
<inputtype=textname=url>
关键字
<inputtype=textname=word>
<inputtype=submitname=Submitvalue=提交>
</form>
<b>

<script>
<!--
functionss(w,id){window.status=w;returntrue;}
functioncs(){window.status=;}
functionclk(url,ct,cd,sg){if(document.images){varu=;if(url)u=&url=+escape(url).replace(/\+/g,%2B);newImage().src=/url?sa=T&ct=+escape(ct)+&cd=+escape(cd)+u+&ei=r9vyQ9ypE5GsoQKL4KDyCg+sg;}returntrue;}
functionga(o,e){if(document.getElementById){vara=o.id.substring(1);varp=,r=,t,f,h;varg=e.target;if(g){t=g.id;f=g.parentNode;if(f){p=f.id;h=f.parentNode;if(h)r=h.id;}}else{h=e.srcElement;f=h.parentNode;if(f)p=f.id;t=h.id;}if(t==ap==ar==a)returntrue;document.getElementById(a).href+=&ct=bg;window.open(document.getElementById(a).href,nw)}}
//-->
</script>


评论


亲,登录后才可以留言!