可以查询google排名的asp源码_ASP教程-查字典教程网
可以查询google排名的asp源码
可以查询google排名的asp源码
发布时间:2016-12-29 来源:查字典编辑
摘要:以下是源码,请命名为.ASP文件.复制代码代码如下:0thenpp=start+iout=1ExitForendifnextifout=1o...

以下是源码,请命名为.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://www.google.com/search?q="&word&"&hl=zh-CN"

oXMLHTTP.open"GET",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

DimoXMLHTTP'AsObject

DimoCategories'AsObject

DimBodyText

DimPos,Pos1

SetoXMLHTTP=CreateObject("Microsoft.XMLHTTP")

out=0

start=0

pp=0

dowhile(true)

strurl="http://www.google.com/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,">",">")

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="form1"method="post"action="?action=1">

网址:

<inputtype="text"name="url">

关键字

<inputtype="text"name="word">

<inputtype="submit"name="Submit"value="提交">

</form>

<b>

<script>

<>

</script>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类