复制代码代码如下:
<%
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 $" Lalu
GetHttppage = "$ false $"
Fungsi keluar
Endif
DIMHTTP
SetHttp = server.CreateObject ("msxml2.xmlhttp")
Http.open "get", httpurl, false
Http.send ()
Ifhttp.readystate <> 4then
SetHttp = tidak ada
GetHttppage = "$ false $"
Fungsi keluar
Endif
GetHttppage = bytestoBstr (http.responseBody, "GB2312")
SetHttp = tidak ada
Iferr.number <> 0then
Err.clear
Endif
Fungsi endfungsi
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 = tidak ada
Fungsi endfungsi
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)
endif
endwith
myMid = trim (mymid)
setmm_objregexp = tidak ada
fungsi endfungsi
FunctionReglistget (str, patn, mysky)
settempreg = newregexp
tempreg.ignorecase = false
tempreg.global = true
Tempreg.pattern = Patrn
setMatches = tempreg.execute (str)
ForeachMatchInmatches
Konten = Konten & Match.Value & Mysky
Berikutnya
Reglistget = konten
setMatches = tidak ada
settempreg = tidak ada
fungsi endfungsi
Dj54_sf = getHttppage ("http://www.haosf.com/")
Dj54_sf = ganti (dj54_sf, vbcrlf, "")
Dj54_sf = ganti (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 = ganti (dj54_sf, "/", "")
Dj54_bt54_sf = split (dj54_sf, "bt54")
response.write "采集成功 共 采集当日" & ubound (dj54_bt54_sf) -1 & "个 sf <br/>"
setRs = server.CreateObject ("adodb.recordset")
sql = "pilih*fromsfdata"