%@LANGUAGE="JScript" CODEPAGE="936"%> script language=VBScript runat="Server"> Function bytes2BSTR(vIn) strReturn = "" For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode H80 Then strReturn = strReturn Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn Chr(CLng(ThisCharCode) * H100 + CInt(NextCharCode)) i = i + 1 End If Next bytes2BSTR = strReturn End Function
Function ajaxRead(theURL) dim XmlHttp set XmlHttp = CreateObject("Microsoft.XMLHTTP") XmlHttp.Open "GET", theURL, false XmlHttp.setRequestHeader "Content-Type","text/HTML" XmlHttp.Send
dim htmlstr htmlstr = bytes2BSTR(XmlHttp.responseBody) ajaxRead = htmlstr End Function /script>
% var ADOConn; function OpenDatabase(){ try{ ADOConn = new ActiveXObject("ADODB.Connection"); ADOConn.Open ("Provider=Microsoft.Jet.Oledb.4.0;Data Source="+Server.MapPath("getcaiku.mdb")); }catch(e){ ADOConn.close; Response.Write("數(shù)據(jù)庫連接出錯,請檢查連接字串。"); Response.End; } }
function CloseDatabase(){ ADOConn.close; }
Response.Buffer = 1; Server.ScriptTimeout = 99999; //////////可修改以下參數(shù)//////////////// var beginid = 230;//開始ID var endid = 500;//結(jié)束ID //////////////////////////////////////// var arr,tstr,tid,getdata; var countid = 0; Response.Write ("開始采集:從"+beginid+"到"+endid+"hr>"); Response.Flush; OpenDatabase(); var re=new RegExp("title>(.*?) - 彩酷/title>","ig");