佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > 淺談自動(dòng)采集程序及入庫(kù)

淺談自動(dòng)采集程序及入庫(kù)

熱門標(biāo)簽:團(tuán)購(gòu)網(wǎng)站 電子圍欄 銀行業(yè)務(wù) Mysql連接數(shù)設(shè)置 Linux服務(wù)器 科大訊飛語(yǔ)音識(shí)別系統(tǒng) 阿里云 服務(wù)器配置
%
'聲明取得目標(biāo)信息的函數(shù),通過(guò)XML組件進(jìn)行實(shí)現(xiàn)。
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False
.Send
GetURL = bytes2bstr(.responsebody)
'對(duì)取得信息進(jìn)行驗(yàn)證,如果信息長(zhǎng)度小于100則說(shuō)明截取失敗
if len(.responsebody)100 then
response.write "獲取遠(yuǎn)程文件 a href="url" target=_blank>"url"/a> 失敗。"
response.end
end if
End With
Set Retrieval = Nothing
End Function

' 二進(jìn)制轉(zhuǎn)字符串,否則會(huì)出現(xiàn)亂碼的!
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

'聲明截取的格式,從Start開始截取,到Last為結(jié)束
Function GetKey(HTML,Start,Last)
filearray=split(HTML,Start)
filearray2=split(filearray(1),Last)
GetKey=filearray2(0)
End Function

Dim Softid,Url,Html,Title
'獲取要取頁(yè)面的ID
SoftId=Request("Id")
Url="http://www3.skycn.com/soft/"SoftId".html"
Html = GetURL(Url)
'以截取天空軟件的軟件名為例子
Title = GetKey(Html,"font color='#004FC6' size='3'>","/font>/b>/td>/tr>")

'打開數(shù)據(jù)庫(kù),準(zhǔn)備入庫(kù)
dim connstr,conn,rs,sql
connstr="DBQ="+server.mappath("db1.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=server.createobject("adodb.recordset")
sql="select [列名] from [表名] where [列名]='"Title"'"
rs.open sql,conn,3,3
if rs.eof and rs.bof then
rs("列名")=Title
rs.update
set rs=nothing
end if
set rs=nothing
Response.Write"采集完畢!"
%>

標(biāo)簽:棗莊 衡水 大理 蚌埠 衢州 廣元 江蘇 萍鄉(xiāng)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《淺談自動(dòng)采集程序及入庫(kù)》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    乌鲁木齐市| 无锡市| 四川省| 乌审旗| 湟中县| 康马县| 苍南县| 新疆| 犍为县| 潢川县| 忻城县| 开鲁县| 永康市| 萨迦县| 苗栗市| 神池县| 原阳县| 贵定县| 中阳县| 启东市| 长寿区| 宾川县| 神农架林区| 蓬安县| 邹城市| 岱山县| 循化| 丽水市| 凉城县| 景谷| 襄城县| 宁武县| 安康市| 慈利县| 伊宁市| 黑水县| 肇州县| 望城县| 沁阳市| 荥阳市| 柳州市|