<%
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 = "" font-size:9pt; ""
Response.writehehe
functionhello(strurl、strstart、strend、patrn、replstr)
str = getbody(strurl)
str = mymid(str、strstart、strend)
str = applageetest(patrn、replstr、str)
こんにちは= str
エンド機能
functionmymid(str、strstart、strend)
ifstrstart = "" then
i = 0
それ以外
i = strust(str、strstart)
endif
ifstrend = "" then
j = len(str)
それ以外
j = strust(i、str、strend)
endif
mymid = mid(str、i、j-i+1)
エンド機能
functionReplacetest(patrn、replstr、str1)
Dimregex、マッチ、マッチ
setRegex = newRegexp
regex.pattern = patrn
regex.ignorecase = true
regex.global = true
setMatches = regex.execute(str1)
foreachmatchinmatches
applageetest =appledetest®ex.replace(match.value、replstr)
次
エンド機能
functiongetbody(url)
setobjxml = createObject( "microsoft.xmlhttp")
withobjxml
.Open "Get"、url、false ""、 "
。送信
GetBody = .ResponseBody
終わりに
getBody = bytestobstr(getbody、 "gb2312")
setobjxml =何もありません
エンド機能
functionbytestobstr(strbody、codebase)
setobjstream = server.createObject( "adodb.stream")
withobjstream
.type = 1
.mode = 3
。開ける
.writestrbody
.position = 0
.type = 2
.charset = codebase
bytestobstr = .readText
。近い
終わりに
setobjstream =何もない
エンド機能
%>
其他调用示例:
hehe = hello( "http://list.mp3.baidu.com/song/a.htm"、 "<tablewidth =" "" 90% "" border = "" "" "" "" "" "" align = "" "cellpadding =" "3" cellspacing = "" "" bgolor = ""#f5ff5f5 ""> " 、 "<divalign = center>"、 "。