Ce qui suit est le code source, veuillez le nommer en tant que fichier .asp
La copie de code est la suivante:
<%
bpn = request ("bpn")
si (bpn = "") alors
bpn = "0"
endire
INTBPN = CINT (BPN)
ifrequest ("action") = "1" puis
word = request ("word")
url = request ("url")
ifword <> "" alors
getCategories ()
ifurl <> "" alors
getCategories2 ()
endire
endire
endire
FunctionGetCategories ()
Response.Write ("<b> '" & Word & "' Le mot clé est parmi les 10 meilleurs sites Web du classement de recherche de Baidu! </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 = instr (bodyText, "<body")
pos1 = instr (bodyText, "</gody>")
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 (corps, "<br>")
Titre = Body1 (0)
theurl = body1 (2)
theurl = remplacer (theurl, "plus de résultats sur", "")
Response.Write ("T:" & Title)
réponse.write ("<br>")
réponse.write ("u:" & theurl)
réponse.write ("<br> <hr>")
suivant
SetOxmlhttp = rien
iFerr.Number <> 0THEN
Il y a eu une réponse d'erreur.WRITE "Response.Write, Error Description:" & err.description & "<br> Error Source" & err.source
réponse.end ()
endire
Finition de fin
FunctionGetCategories2 ()
onerrorresumenext
Dimoxmlhttp'asobject
Dimocategories'sobject
Dimbodytext
DIMPOS, POS1
SetOxMlHttp = CreateObject ("Microsoft.xmlhttp")