<ee****@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi,
A site Im working with has an API that allows one to retrieve files.
The file is a Word doc sent as a byte stream.
url="blah.asp?fileid=777777"
set oXMLHTTP=server.CreateObject("MSXML2.ServerXMLHTTP .4.0")
oXMLHTTP.open "POST",url,false
oXMLHTTP.send
binData=oXMLHTTP.responseText
I am trying to save the stream as a file on the Web server. It isn't
working. I've tried using FS.OpenTextFile, Stream.Write, etc.
Nothing is working.
Anyone have any sample code on how to do this?
Thanks
Dim oWinHTTP
Dim oStream
Set oWinHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
oWinHTTP.Open "GET", "blah.asp?fileid=777777", False
oWinHTTP.Send
If oWinHTTP.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write oWinHTTP.responseBody
oStream.SaveToFile "c:\temp\blah777777.doc"
oStream.Close
End If
BTW, Are you sure you need a POST ? Your not sending any data in the send
then GET would be more appropriate.