Tutorials to .com

Tutorials to .com » Asp » Xml » XMLHTTP crawl garbled data solve the problem

XMLHTTP crawl garbled data solve the problem

Print View , by: iSee ,Total views: 3 ,Word Count: 150 ,Date: Wed, 22 Apr 2009 Time: 9:18 AM

Code issues. Make use of this code, I have changed very streamlined.
'Use XMLHTTP to crawl the content of the address to deal with times times
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 to deal with the use of binary data
Function BytesToBstr (strBody, CodeBase)
dim objStream
set objStream = Server.CreateObject ( "Adodb.Stream")
objStream.Type = 1
objStream.Mode = 3
objStream.Write strBody
objStream.Position = 0
objStream.Type = 2
objStream.Charset = CodeBase
BytesToBstr = objStream.ReadText
set objStream = nothing
End Function

Asp and XML related Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.