复制代码代码如下:
<%
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 $" então
Gethttppage = "$ false $"
Saída de saída
Endif
Dimhttp
Sethttp = server.createObject ("msxml2.xmlHttp")
Http.open "get", httpurl, false
Http.send ()
Ifhttp.readyState <> 4Then
Sethttp = nada
Gethttppage = "$ false $"
Saída de saída
Endif
Gethttppage = bytestobstr (http.Responsebody, "GB2312")
Sethttp = nada
Iferr.number <> 0then
Err.clear
Endif
Função final
FunctionByTestobstr (corpo, 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 = nada
Função final
functionmid (byvala_string, byvala_strpattern)
DIMMM_OBJREGEXP
DIMMM_STREXECUTE
setmm_objregexp = newRegexp
commm_objregexp
.Pattern = a_strpattern
.Ignorecase = true
.Global = false
setmm_strexecute = .Execute (a_string)
ifmm_strexecute.count <> 0then
mymid = mm_strexecute (0) .submatches (0)
endif
ENDWITH
mymid = Trim (mymid)
setmm_objregexp = nada
Função final
FunctionReglistget (str, patn, mysky)
SettemPreg = newRegexp
tempereg.ignorecase = false
tempeg.global = true
tempereg.pattern = patn
setMatches = tempreg.execute (str)
foreachMatchinMatches
Content = Content & Match.value & Mysky
próximo
Reglistget = content
setMatches = nada
SettemPreg = nada
Função final
Dj54_sf = gethttppage ("http://www.haosf.com/")
Dj54_sf = substituir (dj54_sf, vbcrlf, "")
Dj54_sf = substituir (dj54_sf, chr (10), "")
Dj54_sf = Trim (mymid (dj54_sf, "zjkf.asp" & ch (34) & "> </script> (.+?) <ScriptLanguage = javascriptsrc =" & chr (34) & "txtj2.asp" & ch (34) & ">"))
DJ54_SF = RegListget (DJ54_SF, "<SCRIPT> O (.+?) </sCript>", "BT54")
Dj54_sf = substituir (dj54_sf, "/", "")
DJ54_BT54_SF = SPLIT (DJ54_SF, "BT54")
Response.Write "采集成功 共 采集当日" & ubound (DJ54_BT54_SF) -1 & "个 SF <br/>"
setrs = server.createObject ("adodb.recordset")
sql = "selecione*fromsfdata"