以下はソースコードです。.aspファイルに名前を付けてください
コードコピーは次のとおりです。
<%
bpn = request( "bpn")
if(bpn = "")then
bpn = "0"
endif
intbpn = cint(bpn)
ifrequest( "action")= "1" then
word = request( "word")
url = request( "url")
ifword <> ""それから
getCategories()
ifurl <> ""それから
getCategories2()
endif
endif
endif
functiongetcategories()
Response.write( "<b> '"&word& "'キーワードは、Baidu Searchランキングのトップ10のWebサイトの1つです!</b> <br>")
onerrorresumenext
dimoxmlhttp
Dimocategories
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 = strust(bodytext、 "<body")
pos1 = strust(bodytext、 "</body>")
bodytext = mid(bodytext、pos、pos1)
bodytext = split(bodytext、 "<table")
st = 5
fori = 1to10
thei = st+i
pos = strust(bodytext(thei)、 "<td")
pos1 = strust(bodytext(thei)、 "</td>")
body = mid(bodytext(thei)、pos、len(bodytext(thei))-pos)
body1 = split(body、 "<br>")
title = body1(0)
theurl = body1(2)
theurl = cheplage(theurl、 "more sults on"、 "")
Response.write( "T:"&title)
respons.write( "<br>")
Response.write( "u:"&theurl)
respons.write( "<br> <hr>")
次
setoxmlhttp =何もない
iferr.Number <> 0then
エラー応答がありました。Write "respons.write、エラー説明:"&err.description& "<br>エラーソース"&err.source
Response.End()
endif
エンド機能
functiongetcategories2()
onerrorresumenext
dimoxmlhttp'asobject
dimocategories'asobject
dimbodytext
Dimpos、pos1
setoxmlhttp = createObject( "microsoft.xmlhttp")