以下はソースコードです。名前を付けてください。 ASPファイル。
コードコピーは次のとおりです。
<metahttp-equiv = "content-type" content = "text/html; charset = gb2312">
<%
ifrequest( "action")= "1" then
word = request( "word")
url = request( "url")
ifword <> ""それから
getCategories()
ifurl <> ""それから
getCategories2()
endif
endif
endif
functiongetcategories()
Response.write( "<b> '"&word& "'キーワードは、Google検索ランキングのトップ10のWebサイトの1つです!</b> <br>")
onerrorresumenext
dimoxmlhttp
Dimocategories
dimbodytext
Dimpos、pos1
setoxmlhttp = createObject( "microsoft.xmlhttp")
http = "http://www.google.com/search?q="&word& "&hl = encn"
oxmlhttp.open "get"、http、false
oxmlhttp.send
bodytext = oxmlhttp.responsebody
bodytext = bytestobstr(bodytext、 "utf-8")
pos = strust(bodytext、 "<body")
pos1 = strust(bodytext、 "</body>")
bodytext = mid(bodytext、pos、pos1)
pos = strust(bodytext、 "<div>")
bodytext = mid(bodytext、pos)
pos1 = strust(bodytext、 "</div>")
bodytext = mid(bodytext、1、pos1)
'Response.Write( "::::"&bodytext& "::::")
bodytext = split(bodytext、 "<pclass = g>")
fori = 1to10
pos = strust(bodytext(i)、 "</a>")
thet = mid(bodytext(i)、1、pos+3)
pos = strunt(bodytext(i)、 "<spandir = ltr>")
theu = mid(bodytext(i)、pos)
pos1 = strust(theu、 "</span>")
theu = mid(theu、1、pos1-1)
Response.write( "T:"&thet& "<br>")
Response.write( "u:"& "<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")