A good example with XMLHTTP

xiaoxiao2021-03-05  23

<% on Error Resume Nextdim ID, URL, GetCode, M, I, J, S, D, NS, Nd, Num, NameId = Trim (Request.QueryString ("ID")) '1. Get all content FUNCTION getHTTPPage (url) dim http set http = Server.createobject ( "Microsoft.XMLHTTP") Http.open "GET", url, false Http.send () if Http.readystate <> 4 then exit function end if getHTTPPage = bytesToBSTR ( HTTP.RESPONSEBODY, "GB2312") set http = Nothing if Err.Number <> 0 Then Err.clear End Function

'2. transcoding Function BytesToBstr (body, Cset) dim objstream set objstream = Server.CreateObject ( "adodb.stream") objstream.Type = 1 objstream.Mode = 3 objstream.Open objstream.Write body objstream.Position = 0 objstream .Type = 2 objstream.charset = cset bytestobstr = objstream.readtext objstream.close set objstream = Nothingend Function

'Get coded URLFunction MyReplace (convstr) convstr = Replace (convstr, "yvi", "1") convstr = replace (convstr, "esr", "2") convstr = replace (convstr, "sxn", "3") Convstr = Replace (CONVSTR, "STI", "4") Convstr = Replace (Convstr, "WFU", "5") Convstr = Replace (Convstr, "LQU", "6") convstr = Replace (convstr, "QGI "," 7 ") convstr = Replace (convstr," limited "," 8 ") convstr = replace (convstr," jfu "," 9 ") convstr = replace (convstr," lsn "," 0 ") convstr = Replace (convstr, "xpg", "/") convstr = replace (CONVSTR, "XQD", ".") convstr = replace (conntr, "," ") convstr = replace (convstr,"% 20 "," ") Convstr = Replace (Convstr," KWD "," WMA ") MyReplace = Convstrend Function

IF id = "1" THEN URL = TRIM (Request.form ("TXTURL")) IF URL = "" "" GETMUSIC.ASP ") response.end () end if 'url =" http: / / www.ting88.com/musiclist/1454.htm "s = 0 d = 0 ns = 0 nd = 0 getcode = gethttppage (URL) NUM = MID (getCode, INSTRREV (Getcode,". This page found "& Name &" "& num &" "" "" "" "response.write"

page URL: "& URL &"
Sequence number song name Operation "for i = 1 to Num s = INSTR (i S, getcode, "checked" "value = '") D = I

D, getCode, "KWD '>") NS = INSTR (i ns, getcode, "word =") ND = INSTR (i nd, getcode, "& inc=") response.write "

"& I &" " & MID (GetCode, NS 5, ND-NS-5) & "