复制代码代码如下:
-
dj54_path = "data/data.mdb" '数据库地址
setConn = server.createObject ("adodb.connection"))
connstr = "ผู้ให้บริการ = microsoft.jet.oledb.4.0; dataSource =" & server.mappath (dj54_path)
conn.openconnstr
FunctionGetHttppage (httpurl)
ifisnull (httpurl) = trueorhttpurl = "$ false $"
gethttppage = "$ false $"
exitfunction
endif
dimhttp
sethttp = server.createObject ("msxml2.xmlhttp"))
http.open "get", httpurl, false
http.send ()
ifhttp.readystate <> 4 จากนั้น
sethttp = ไม่มีอะไร
gethttppage = "$ false $"
exitfunction
endif
gethttppage = bytestobstr (http.responsebody, "GB2312"))
sethttp = ไม่มีอะไร
iferr.number <> 0 แล้ว
err.lear
endif
endfunction
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 = ไม่มีอะไร
endfunction
functionmymid (byvala_strstring, byvala_strpattern)
dimmm_objregexp
dimmm_strexecute
setmm_objregexp = newregexp
withmm_objregexp
.pattern = a_strpattern
.ignorecase = true
.global = เท็จ
setmm_strexecute = .execute (a_strstring)
ifmm_strexecute.count <> 0 แล้ว
mymid = mm_strexecute (0) .submatches (0)
endif
จบลงด้วย
mymid = trim (mymid)
setmm_objregexp = ไม่มีอะไร
endfunction
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 = เนื้อหา
setMatches = ไม่มีอะไร
setTempreg = ไม่มีอะไร
endfunction
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 = javascriptrc =" & chr (34) & "txtj2.asp" & chr (34) & "
dj54_sf = reglistget (dj54_sf, "<script> o (.+?) </script>", "BT54")
DJ54_SF = แทนที่ (DJ54_SF, "/", "")
DJ54_BT54_SF = แยก (DJ54_SF, "BT54")
Response.write "采集成功共采集当日" & Ubound (DJ54_BT54_SF) -1 & "个 SF <br/>"
setRs = server.createObject ("adodb.recordset"))
sql = "เลือก*fromsfdata"