可以查询google排名的asp源码

时间:2021-05-25

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

复制代码 代码如下:
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<%
ifrequest("action")="1"then
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="http:///search?q="&word&"&hl=zh-CN&start="&start
'response.write(strurl&"<br>")

oXMLHTTP.open"GET",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,">","&gt;")
fString=replace(fString,"<","&lt;")
fString=Replace(fString,CHR(32),"")'&nbsp;
fString=Replace(fString,CHR(9),"")'&nbsp;
fString=Replace(fString,CHR(34),"&quot;")
fString=Replace(fString,CHR(39),"&#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="form1"method="post"action="?action=1">
网址:
<inputtype="text"name="url">
关键字
<inputtype="text"name="word">
<inputtype="submit"name="Submit"value="提交">
</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==a||p==a||r==a)returntrue;document.getElementById(a).href+="&ct=bg";window.open(document.getElementById(a).href,'nw')}}
//-->
</script>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章