2023-09-07 分類(lèi): 網(wǎng)站建設(shè)
<%
'================================================
'函數(shù)名:GetRemoteData
'作 用:獲取遠(yuǎn)程網(wǎng)頁(yè)代碼內(nèi)容,獲取HTTP頁(yè)
'參 數(shù):url ----遠(yuǎn)程URL
'語(yǔ) 言:VbScript (ASP)
'返回值:遠(yuǎn)程HTML代碼
'================================================
Public Function GetRemoteData(ByVal URL)
Cset = "GB2312" '設(shè)置遠(yuǎn)程網(wǎng)頁(yè)的編碼體例
Dim strHeader
Dim l
On Error Resume Next
Dim Retrieval
Dim ObjStream
Set ObjStream = CreateObject("ADODB.Stream")
ObjStream.Type = 1
ObjStream.Mode = 3
ObjStream.Open
Set Retrieval = CreateObject("MSXML2.XMLHTTP")
With Retrieval
.Open "GET", URL, False
.setRequestHeader "Referer", URL
.send
If .readyState <> 4 Then Exit Function
If .Status > 300 Then Exit Function
'--獲取遠(yuǎn)程目標(biāo)網(wǎng)頁(yè)文件頭
strHeader = .getResponseHeader("Content-Type")
strHeader = UCase(strHeader)
ObjStream.Write (.responseBody)
End With
Set Retrieval = Nothing
If Len(strHeader) > 0 Then
'--獲取目標(biāo)網(wǎng)頁(yè)文件編碼
l = InStrRev(strHeader, "CHARSET=", -1, 1)
If l > 0 Then
Cset = Right(strHeader, Len(strHeader) - l - 7)
Else
Cset = Cset
End If
End If
ObjStream.Position = 0
ObjStream.Type = 2
ObjStream.Charset = Trim(Cset)
GetRemoteData = ObjStream.ReadText
ObjStream.Close
Set ObjStream = Nothing
Exit Function
End Function
%>
當(dāng)前文章:獲取遠(yuǎn)程網(wǎng)頁(yè)代碼內(nèi)容GetRemoteData
URL分享:http://www.rwnh.cn/news20/281570.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站導(dǎo)航、全網(wǎng)營(yíng)銷(xiāo)推廣、定制網(wǎng)站、品牌網(wǎng)站設(shè)計(jì)、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容