<%
hehe = hello ("http://mmsg.qq.com/cgi-bin/gddylist?type=13&sort=1&page=3", "<Html>", "</html>", ".*(<tdwidth =" " 35%"" bgcolor = ""#[/dabcde] {6} ""> (.*) </td>) [./ n]*"," <fontstyle = "" Ukuran Font: 9pt; "" Color = Blue> $ 2 </font> <br> ")
respons.writehehe
FunctionHello (Strurl, Strstart, Strend, Patrn, REPLSTR)
Str = getbody (strurl)
Str = mymid (str, strstart, strend)
Str = replacetest (patn, replstr, str)
Halo = str
Fungsi endfungsi
Functionmymid (str, strstart, strend)
Ifstrstart = "" lalu
i = 0
Kalau tidak
i = instr (str, strstart)
Endif
Ifstrend = "" lalu
J = len (str)
Kalau tidak
j = instr (i, str, strend)
Endif
Mymid = mid (str, i, j-i+1)
Fungsi endfungsi
FunctionReplacetest (Patrn, REPLSTR, STR1)
Dimregex, pertandingan, pertandingan
SetRegex = newregexp
Regex.pattern = Patrn
Regex.ignorecase = true
regex.global = true
SetMatches = regex.execute (str1)
ForeachMatchInmatches
Replacetest = replacetest®ex.replace (match.value, replstr)
Berikutnya
Fungsi endfungsi
FunctionGody (URL)
Setobjxml = createObject ("microsoft.xmlhttp")
WithObjXml
.Open "get", url, false, "", ""
.Mengirim
Getbody = .responseBody
Endwith
Getbody = bytestoBstr (getbody, "gb2312")
Setobjxml = tidak ada
Fungsi endfungsi
FunctionByTestObstr (strbody, codeBase)
SetoBjStream = server.CreateObject ("adodb.stream")
WithoBJStream
.Type = 1
.Mode = 3
.Membuka
.WriteStrbody
.Posisi = 0
.Type = 2
.Charset = basis kode
BytestoBstr = .readtext
.Menutup
Endwith
Setobjstream = tidak ada
Fungsi endfungsi
%>
其他调用示例 :
hehe=Hello("http://list.mp3.baidu.com/song/A.htm","<tablewidth=""90%""border=""0""align=""center""cellpadding=""3""cellspacing=""0""bgcolor=""#f5f5f5"">" , "<veign = center>", ".*(<Tdwidth =" "20%" "> <ahref =" ".*/. Htm" "target = _blank>) (.*) (</a> </tm) [./ n]", "<fontstyle =" "font-size: 9pt;"