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

主頁 > 知識庫 > XMLHTTP抓取遠程數(shù)據(jù)的后期處理

XMLHTTP抓取遠程數(shù)據(jù)的后期處理

熱門標(biāo)簽:銀行業(yè)務(wù) 電子圍欄 科大訊飛語音識別系統(tǒng) 阿里云 Linux服務(wù)器 團購網(wǎng)站 Mysql連接數(shù)設(shè)置 服務(wù)器配置

hehe = Hello("http://mmsg.qq.com/cgi-bin/gddylist?Type=13Sort=1Page=3", "html>", "/html>", ".*(td width=""35%"" bgcolor=""#[\dABCDE]{6}"">(.*)/td>)[.\n]*", "font style=""font-size:9pt;"" color=blue>$2/font>br>") 
response.Write hehe 

Function Hello(strUrl, strStart, strEnd, patrn, replStr) 
Str = GetBody(strUrl) 
Str = MyMid(Str, strStart, strEnd) 
Str = ReplaceTest(patrn, replStr, Str) 
Hello = Str 
End Function 

Function MyMid(Str, strstart, strend) 
If strstart = "" Then 
i = 0 
Else 
i = InStr(Str, strstart) 
End If 
If strend = "" Then 
j = Len(Str) 
Else 
j = InStr(i, Str, strend) 
End If 
MyMid = Mid(Str, i, j - i + 1) 
End Function 

Function ReplaceTest(patrn, replStr, str1) 
Dim regEx, match, matches 
Set regEx = New RegExp 
regEx.Pattern = patrn 
regEx.IgnoreCase = True 
regEx.Global = True 
Set matches = regEx.Execute(str1) 
For Each match in matches 
ReplaceTest = ReplaceTestregEx.Replace(Match.Value, replStr) 
Next 
End Function 

Function GetBody(Url) 
Set objXML = createObject("Microsoft.XMLHTTP") 
With objXML 
.Open "Get", Url, False, "", "" 
.SEnd 
GetBody = .ResponseBody 
End With 
GetBody = BytesToBstr(GetBody, "GB2312") 
Set objXML = Nothing 
End Function 

Function BytesToBstr(strBody, CodeBase) 
Set objStream = Server.createObject("Adodb.Stream") 
With objStream 
.Type = 1 
.Mode = 3 
.Open 
.Write strBody 
.Position = 0 
.Type = 2 
.Charset = CodeBase 
BytesToBstr = .ReadText 
.Close 
End With 
Set objStream = Nothing 
End Function 
%> 
其他調(diào)用示例: 
hehe = Hello("http://list.mp3.baidu.com/song/A.htm", "table width=""90%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""0"" bgcolor=""#f5f5f5"" >", "DIV align=center>", ".*(td width=""20%"">a href="".*\.htm"" target=_blank>)(.*)(/a>/td>)[.\n]*", "font style=""font-size:9pt;"" color=blue>$2/font>br>")

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

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

    • 400-1100-266
    济南市| 平乐县| 陆川县| 旬邑县| 武威市| 伊宁市| 钦州市| 锡林郭勒盟| 青岛市| 清徐县| 鹰潭市| 麻栗坡县| 龙口市| 宜宾市| 沭阳县| 岑溪市| 双柏县| 庆城县| 景谷| 定兴县| 左权县| 彰武县| 石狮市| 蒙城县| 长海县| 芮城县| 湘西| 米林县| 桂平市| 平湖市| 道孚县| 江口县| 卫辉市| 都安| 焦作市| 洛隆县| 商都县| 普宁市| 青海省| 霞浦县| 永安市|