Berikut ini adalah kode sumber, silakan beri nama sebagai file .asp
Salinan kode adalah sebagai berikut:
<%
bpn = permintaan ("bpn")
if (bpn = "") lalu
bpn = "0"
endif
intbpn = cint (bpn)
ifRequest ("Action") = "1" Lalu
word = request ("word")
url = permintaan ("url")
ifword <> "" lalu
getCategories ()
ifurl <> "" lalu
getCategories2 ()
endif
endif
endif
FunctionGetCategories ()
Response.write ("<b> '" & Word & "' 'kata kunci adalah salah satu dari 10 situs web teratas dalam peringkat pencarian Baidu! </b> <br>")
OnerrorresumeNext
Dimoxmlhttp
Kategori dimoc
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, "<tabel")
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 (tubuh, "<br>")
title = body1 (0)
TheUrl = body1 (2)
theUrl = ganti (theUrl, "lebih banyak hasil pada", "")
response.write ("t:" & title)
response.write ("<br>")
response.write ("u:" & theUrl)
response.write ("<br> <hr>")
Berikutnya
Setoxmlhttp = tidak ada
iferr.number <> 0then
Ada respons kesalahan. Menulis "respons.write, deskripsi kesalahan:" & err.description & "<br> Sumber kesalahan" & err.source
response.end ()
endif
Fungsi endfungsi
FunctionGetCategories2 ()
OnerrorresumeNext
Dimoxmlhttp'asObject
Dimocategories'asObject
DimbodyText
DIMPOS, POS1
Setoxmlhttp = createObject ("microsoft.xmlhttp")