다음은 소스 코드입니다. 이름을 지정하십시오. ASP 파일.
코드 사본은 다음과 같습니다.
<metahttp-equiv = "content-type"content = "text/html; charset = gb2312">
<%
ifrequest ( "action") = "1"
Word = request ( "Word")
url = request ( "url")
ifword <> ""그런 다음
getCategories ()
ifurl <> ""그런 다음
getCategories2 ()
endif
endif
endif
functiongetCategories ()
response.write ( "<b> '"& Word & "'키워드는 Google 검색 순위의 상위 10 개 웹 사이트 중 하나입니다! </b> <br>")
onerrorresumenext
dimoxmlhttp
디모컬 범주
DimbodyText
Dimpos, POS1
setoxmlhttp = createobject ( "microsoft.xmlhttp")
http = "http://www.google.com/search?q="& word & "& hl = en-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> <br>")
다음
setoxmlhttp = 아무것도 없습니다
iferr.number <> 0then
오류 응답이 있습니다. write "response.write, 오류 설명 :"& err.description & "<br> 오류 소스"& err.source
응답 ()
endif
최종 기능 장애
functiongetCategories2 ()
onerrorresumenext
dimoxmlhttp'asobject
DimoCategories'AsObject
DimbodyText
Dimpos, POS1
setoxmlhttp = createobject ( "microsoft.xmlhttp")