다음은 소스 코드입니다. 이름을 .asp 파일로 지정하십시오.
코드 사본은 다음과 같습니다.
<%
BPN = 요청 ( "BPN")
if (bpn = "")
bpn = "0"
endif
intbpn = cint (bpn)
ifrequest ( "action") = "1"
Word = request ( "Word")
url = request ( "url")
ifword <> ""그런 다음
getCategories ()
ifurl <> ""그런 다음
getCategories2 ()
endif
endif
endif
functiongetCategories ()
response.write ( "<b> '"& Word & "'키워드는 Baidu Search Ranking의 상위 10 개 웹 사이트 중 하나입니다! </b> <br>")
onerrorresumenext
dimoxmlhttp
디모컬 범주
DimbodyText
Dimpos, POS1
setoxmlhttp = createobject ( "microsoft.xmlhttp")
oxmlhttp.open "get", "http://www.baidu.com/baidu?word="& Word, False
oxmlhttp.send
BodyText = oxmlhttp.ResponseBody
bodytext = bytestobstr (bodytext, "gb2312")
pos = instr (bodytext, "<body")
pos1 = instr (bodytext, "</body>")
BodyText = MID (BodyText, POS, POS1)
bodytext = split (bodytext, "<table")
ST = 5
fori = 1to10
thei = st+i
pos = instr (bodytext (thei), "<td")
pos1 = instr (bodytext (thei), "</td>")
body = mid (bodytext (thei), pos, len (bodytext (thei))-pos)
body1 = split (body, "<br>")
제목 = body1 (0)
Theurl = body1 (2)
theurl = replace (theurl, "더 많은 결과 켜짐", "")
response.write ( "T :"& Title)
response.write ( "<br>")
response.write ( "U :"& Theurl)
response.write ( "<br> <hr>")
다음
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")