复制代码代码如下:
<%
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) = trueRhttpurl = "$ false $" entonces
Gethttppage = "$ falso $"
Extinción
Endif
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp")
Http.open "get", httpurl, falso
Http.send ()
Ifhttp.readyState <> 4then
Sethttp = nada
Gethttppage = "$ falso $"
Extinción
Endif
Gethttppage = bytestobstr (http.ResponseBody, "GB2312")
Sethttp = nada
Iferr.number <> 0then
Err.Clear
Endif
Función final
FunctionByTestObstr (Body, CSET)
Dimobjstream
Setobjstream = server.createObject ("ADODB.Stream")
objstream.type = 1
objstream.mode = 3
objstream.
objstream.WriteBody
objstream.position = 0
objstream.type = 2
objstream.charset = cset
Bytestobstr = objstream.readText
objstream.close
setobjstream = nada
Función final
functionMymid (byvala_strstring, byvala_strpattern)
dimmm_objregexp
dimmm_strexecute
setmm_objregexp = newregexp
withmm_objregexp
.Pattern = a_strpattern
.IngineCase = True
.Global = falso
setmm_strexeCute = .execute (a_strstring)
ifmm_strexecute.count <> 0then
mymid = mm_strexecute (0) .submatches (0)
endif
fin
mymid = trim (mymid)
setmm_objregexp = nada
Función final
FunctionReglistget (Str, Patrn, Mysky)
setTempreg = newegexp
tempreg.ignorecase = false
tempreg.global = True
tempreg.pattern = Patrn
setMatches = tempreg.execute (str)
foreachmatchinmatches
Content = content & Match.Value & Mysky
próximo
Reglistget = contenido
setMatches = nada
setTempreg = nada
Función final
Dj54_sf = gethttppage ("http://www.haosf.com/")
Dj54_sf = reemplazar (dj54_sf, vbcrlf, "")
Dj54_sf = reemplazar (dj54_sf, chr (10), "")
Dj54_sf = trim (mymid (dj54_sf, "zjkf.asp" & chr (34) & "> </script> (.
Dj54_sf = reglistget (dj54_sf, "<script> o (.+?) </script>", "bt54")
Dj54_sf = reemplazar (dj54_sf, "/", "")
DJ54_BT54_SF = Split (DJ54_SF, "BT54")
Response.Write "采集成功 共 采集当日" & Ubound (DJ54_BT54_SF) -1 y "个 Sf <br/>"
setrs = server.createObject ("ADODB.Recordset")
sql = "select*fromSfData"