DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> AJAX入門 >> AJAX詳解 >> XMLHTTP抓取數據時亂碼問題解決
XMLHTTP抓取數據時亂碼問題解決
編輯:AJAX詳解     
內碼問題.用這段代碼的吧,我已經改得很精簡了.
'使用XMLHTTP抓取地址並進次內容處理
Function GetBody(Url)
Dim objXML
On Error Resume Next
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
'使用Adodb.Stream處理二進制數據
Function BytesToBstr(strBody,CodeBase)
dim obJStream
set obJStream = Server.CreateObject("Adodb.Stream")
obJStream.Type = 1
obJStream.Mode =3
obJStream.Open
obJStream.Write strBody
obJStream.Position = 0
obJStream.Type = 2
obJStream.Charset = CodeBase
BytesToBstr = obJStream.ReadText
obJStream.Close
set obJStream = nothing
End Function

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved