McKirahan
Tue Apr 27 18:22:15 CDT 2004
"Marcus Uermoes" <mju@chello.at> wrote in message
news:XYyjc.562268$Or1.374740@news.chello.at...
> Hi to all,
>
> does anyone know where to find a referende-guide for the
> "Microsoft.XMLhttp"-object?
>
> and how to save a picture-file from a (knowen) internet-address?
>
> thank's to all for helping.
>
> Marcus
A Google search found:
IXMLHTTPRequest
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/ht
m/xmobjxmlhttprequest.asp
December 13, 2002 -- readyState
http://www.scottandrew.com/weblog/2002_12#a000474
The following works for me; watch for word-wrap.
Option Explicit
Const cVBS = "xmlhttp.vbs"
Const cURL =
http://www.google.com/images/logo.gif
Const cOUT = "c:\temp\"
MsgBox Fetch(cURL,cOUT),vbInformation,cVBS
Function Fetch(xURL,xOUT)
On Error Resume Next
Err.Clear
Dim b
With CreateObject("Microsoft.XMLHTTP")
.Open "GET",xURL,False
.Send
b = .ResponseBody
If Err.Number <> 0 Or .Status <> 200 Then
Fetch = False
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write b
.SaveToFile xOUT,2
End With
Fetch = Err.Number = 0
End Function