复制代码代码如下:
<%
Dj54_path = "data/data.mdb" '数据库地址
SetConn = server.createObject ("adodb.connection")
connstr = "Provider = microsoft.jet.oledb.4.0; dataSource =" & server.mappath (dj54_path)
Conn.openconstr
Functiongethttppage (httpurl)
Ifisnull (httpurl) = trueorhttpurl = "$ false $" then
Gethttppage = "$ false $"
Выходная функция
Эндиф
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp")
Http.open "Get", httpurl, false
Http.send ()
Ifhttp.readystate <> 4then
Sethttp = ничего
Gethttppage = "$ false $"
Выходная функция
Эндиф
Gethttppage = bytestobstr (http.responsebody, "gb2312")
Sethttp = ничего
Iferr.number <> 0then
Err.clear
Эндиф
Конечная функция
Functionbytestobstr (тело, 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_strstring, byvala_strpattern)
dimmm_objregexp
dimmm_strexecute
setmm_objregexp = newRegexp
withmm_objregexp
.Pattern = a_strpattern
.IgnoreCase = true
.Global = false
setmm_strexecute = .execute (a_strstring)
ifmm_strexecute.count <> 0then
mymid = mm_strexecute (0) .submatches (0)
эндиф
Энд
mymid = trim (mymid)
setmm_objregexp = ничего
конечная функция
Functionreglistget (str, patrn, mysky)
SetTempreg = NewRegexp
tempreg.ignorecase = false
Tempreg.global = true
Tempreg.pattern = Patrn
setmatches = tempreg.execute (str)
foreachmatchinmatches
Content = Content & Match.value & Mysky
следующий
Reglistget = content
setMatches = ничего
SetTemperge = ничего
конечная функция
Dj54_sf = gethttppage ("http://www.haosf.com/")
Dj54_sf = reply (dj54_sf, vbcrlf, "")
Dj54_sf = reply (dj54_sf, chr (10), "")
Dj54_sf = trim (mymid (dj54_sf, "zjkf.asp" & chr (34) & "> </script> (.+?)
Dj54_sf = reglistget (dj54_sf, "<cript> o (.+?) </Script>", "bt54")
Dj54_sf = replace (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*utsfdata"