复制代码代码如下:
<%
dj54_path = "data/data.mdb" '数据库地址
setConn = server.createObject( "adodb.connection")
connstr = "provider = microsoft.jet.oledb.4.0; dataSource ="&server.mappath(dj54_path)
conn.openconnstr
functiongethttppage(httpurl)
ifisnull(httpurl)= trueorhttpurl = "$ false $" then
gethttppage = "$ false $"
exitFunction
endif
dimhttp
sethttp = server.createObject( "msxml2.xmlhttp")
http.open "get"、httpurl、false
http.send()
ifhttp.ReadyState <> 4then
sethttp =何もない
gethttppage = "$ false $"
exitFunction
endif
gethttppage = bytestobstr(http.responsebody、 "gb2312")
sethttp =何もない
iferr.Number <> 0then
err.clear
endif
エンド機能
functionbytestobstr(body、cset)
DimobjStream
setobjstream = server.createObject( "adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open
objstream.writebody
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readtext
objstream.close
setobjstream =何もない
エンド機能
functionmymid(byvala_string、byvala_strpattern)
dimmm_objregexp
dimmm_strexecute
setmm_objregexp = newRegexp
withmm_objregexp
.pattern = a_strpattern
.ignorecase = true
.global = false
setmm_strexecute = .execute(a_string)
ifmm_strexecute.count <> 0then
mymid = mm_strexecute(0).submatches(0)
endif
終わりに
mymid = trim(mymid)
setmm_objregexp =何も
エンド機能
functionreglistget(str、patrn、mysky)
setempreg = newRegexp
tempreg.ignorecase = false
tempreg.global = true
tempreg.pattern = patrn
setMatches = tempreg.execute(str)
foreachmatchinmatches
content = content&match.value&mysky
次
reglistget = content
setMatches = Nothing
setempreg =何もない
エンド機能
dj54_sf = gethttppage( "http://www.haosf.com/")
dj54_sf =置換(dj54_sf、vbcrlf "")
dj54_sf =置換(dj54_sf、chr(10)、 "")
dj54_sf = trim(mymid(dj54_sf、 "zjkf.asp"&chr(34)& "> </script>(。+?)<scriptlanguage = javascriptsrc ="&chr(34)& "txtj2.asp"&chr(34)& ">"))))
dj54_sf = reglistget(dj54_sf、 "<script> o(。+?)</script>"、 "bt54")
DJ54_SF =交換(DJ54_SF、 "/"、 "")
dj54_bt54_sf = split(dj54_sf、 "bt54")
Response.Write "采集成功共采集当日"&ubound(dj54_bt54_sf)-1& "个sf <br/>"
setrs = server.createObject( "adodb.recordset")
sql = "select*fromsfdata"