Re: Using wininet over http to get a get.cgi file



Il giorno Fri, 13 Jun 2008 02:36:21 -0700 (PDT), Skylan <bas.van.lieshout@xxxxxxx> ha
scritto:

Hello, I want to access a projector over the network with a vb script
so I can read the lamp hours and status. Can someone help me with some
examples with wininet? I made a search (google as well as Microsoft)
but I can not get it in a vbscript.

I use mshtml.

Sub DownloadWithXMLHTTP (sSource,sDest)
'Download a file using activeX Object XMLHTTP
'and save to sDest using ADO Stream
set oHTTP = WScript.CreateObject("Microsoft.XMLHTTP")
oHTTP.open "GET", sSource, False
oHTTP.send
set oStream = createobject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
oStream.type = adTypeBinary
oStream.open
oStream.write oHTTP.responseBody
oStream.savetofile sDest, adSaveCreateOverWrite
set oStream = nothing
set oHTTP = nothing
end sub

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
.



Relevant Pages

  • Re: Transfer file from VBS via HTTP
    ... oHTTP.open "GET", sSource, False ... set oStream = createobject ... Const adSaveCreateOverWrite = 2 ... oStream.savetofile sDest, adSaveCreateOverWrite ...
    (microsoft.public.scripting.vbscript)
  • Re: Want to Save Files via the browser - in vb script
    ... Sub DownloadWithXMLHTTP ... 'and save to sDest using ADO Stream ... set oHTTP = WScript.CreateObject ... Const adSaveCreateOverWrite = 2 ...
    (microsoft.public.scripting.vbscript)
  • Re: Recommended Approach
    ... Dan heres a vbscript that download a zip file from web, ... set oHTTP = WScript.CreateObject ... oStream.savetofile sDest, adSaveCreateOverWrite ...
    (microsoft.public.sqlserver.security)
  • error using STREAM.ReadText
    ... I use VBScript: ... set oHTTP = CreateObject ... set oStream = createobject ... Error msg: ...
    (microsoft.public.sqlserver.dts)