XMLHTTP grabs data when garbled

xiaoxiao2021-03-06  38

'Use XMLHTTP to capture the address and transfer content processing

Function GetBody (URL)

DIM Objxml

ON Error ResMe next

Set objxml = creteObject ("Microsoft.xmlhttp")

With objxml

.Open "get", URL, FALSE, "" "" "

Ssend

GetBody = .Responsebody

End with

GetBody = Bytestobstr (GetBody, "GB2312")

Set objxml = Nothing

END FUNCTION

'Handling binary data using 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

Transfer from:

http://goaler.xicp.net/showlog.asp?id=486

转载请注明原文地址:https://www.9cbs.com/read-65985.html

New Post(0)