How to POST data to Google Analytics with VB6 - vb6

We have an ancient VB6 component that needs Google Analytics tracking. I am using the Internet Transfer Control to POST data via HTTP. I cannot see my tracking data in the Google Analytics reports. This leads me to believe that I cam calling POST incorrectly.
I have already added Google Analytics tracking to a desktop .Net Application and can see that data so I know it works.
I have a VB6 form with a button on it. The button-click event executes:
Dim var1 As String
var1 = "v=1&tid=UA-00000000-1&cid=123&t=appview&cd=VBScreen"
Inet1.Execute "http://www.google-analytics.com/collect", "POST", var1
This doesn't return an error but no data can be seen in the Google Analytics reporting pages. What am I going wrong?
I do not need to use the Internet Transfer Control if there is some other simple way to do this.
After Execute() is called, Inet1_StateChanged is fired and the state is icResponseCompleted. Inet1.ResponseInfo == "" and Inet1.StillExecuting == False.

Try this way using xmlhttp. Edit the url's etc. If it seems to work comment out the if / end if to dump info even if seeming to work. It's vbscript but vbscript works in vb6.
On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "http://www.microsoft.com/en-au/default.aspx", False
'This is IE 8 headers
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
line =""
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error getting file"
Line = Line & vbcrlf & "=================="
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
Line = Line & vbcrlf & "Source " & err.source
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "HTTP Error " & File.Status & " " & File.StatusText
Line = Line & vbcrlf & File.getAllResponseHeaders
wscript.echo Line
Err.clear
wscript.quit
End If
On Error Goto 0
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile "c:\users\test.txt", 2

I don't recall why the original code did not work, but I was able to get it working with the following code:
Dim xmlhttp As WinHttp.WinHttpRequest
Set xmlhttp = New WinHttp.WinHttpRequest
Dim var1 As String
var1 = "v=1&tid=UA-00000000-0&cid=123&an=MyAN&av=1.0&t=event&ec=ecData&ea=eaData&el=elData"
xmlhttp.Open "POST", "http://www.google-analytics.com/collect", False
xmlhttp.send var1

Related

Downloading large files using XML HTTP Request

I'm trying to make a simple launcher for a game that can install and uninstall mods, and update them. I don't know a ton about VBScript, so I got most of the downloading/update code off of the internet. I have most of the code done, but I have a problem. I'm trying to download about a 1/2 GB large zip folder off of my google drive. It was working when all I had was a simple text file in the zip folder as a test, but all it did was download a corrupted zip folder. WinRar can't open it, giving the error message "The archive is in either unknown format or damaged". So my question is does the code that I'm using have a limit to the file size? I'm trying to download https://drive.google.com/uc?export=download&id=0BxlXlAM9nwYTZTFUdXpWQlJyN2M which is a direct download link to my google drive file.
Dim http: Set http = createobject("Microsoft.XMLHTTP")
Dim stream: Set stream = createobject("Adodb.Stream")
http.Open "GET", "https://drive.google.com/uc?export=download&id=0BxlXlAM9nwYTZTFUdXpWQlJyN2M", False
http.Send
With stream
.Type = 1
.Open
.Write http.responseBody
.SaveToFile "c:\updates\normaldata\normal.zip", 2
End With
As #Noodles already pointed out your original link is being redirected to a confirmation page, because the file is too large to be scanned for malware. You need to extract the actual download link from that page, e.g. like this:
baseUrl = "https://drive.google.com"
url = baseUrl & "/uc?export=download&id=0BxlXlAM9nwYTZTFUdXpWQlJyN2M"
Set http = CreateObject("Microsoft.XMLHTTP")
http.Open "GET", url, False
http.Send
If http.Status <> 200 Then
WScript.Echo http.Status & " " & http.StatusText
WScript.Quit 1
ElseIf Left(http.getResponseHeader("Content-Type"), 9) = "text/html" Then
Set html = CreateObject("HTMLFile")
html.Write http.ResponseText
Set dl = html.GetElementById("uc-download-link")
http.Open "GET", Replace(dl.href, "about:", baseUrl), False
http.Send
...
End If
However, when I tried to follow the link I got an access denied error, whereas the download worked fine in a browser. To make the VBScript work you may need to inspect the conversation between browser and the webserver (e.g. with Fiddler) and adjust the second HTTP request according to the results.
First that link is not a direct download. It takes you to a page that warns you the zip can't be virus scanned by Google.
What you aren't doing is
Opening the file in notepad and seeing what it says. Zips start with PK, Executables and dlls with MZ, and you'll recognise HTML. You are downloading a web page that is under 1000 bytes.
You have no error checking. Note my code is 80% error checking.
#define HTTP_STATUS_OK 200 // request completed
It gave you the page it wanted to give you.
This downloads a web page and saves it as a zip. Rename it html and open in internet explorer.
Set fso = CreateObject("Scripting.FileSystemObject")
Set Outp = Wscript.Stdout
Set wshShell = CreateObject("Wscript.Shell")
Set ShApp = CreateObject("Shell.Application")
On Error Resume Next
Set File = WScript.CreateObject("Msxml2.XMLHTTP.6.0")
File.Open "GET", "https://drive.google.com/uc?export=download&id=0BxlXlAM9nwYTZTFUdXpWQlJyN2M", False
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
wscript.echo ""
wscript.echo "Error getting file"
wscript.echo "=================="
wscript.echo ""
wscript.echo "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
wscript.echo "Source " & err.source
wscript.echo ""
wscript.echo "HTTP Error " & File.Status & " " & File.StatusText
wscript.echo File.getAllResponseHeaders
wscript.echo File.ResponseBody
else
On Error Goto 0
wscript.echo "Server Response " & File.Status & " " & File.StatusText
wscript.echo File.getAllResponseHeaders
wscript.echo File.ResponseBody
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile ShApp.Namespace(&h10).self.path & "\file.zip", 2
End If

Vbscript msxml12.XMLHTTP error handling

I use this vbscript code, to download web page:
Dim oXML
Set oXML = CreateObject("msxm12.XMLHTTP")
oXML.Open "GET", "mysite.com", False
oXML.Send
If there is no such web site, I get an error 80004005, Unspecified error at line "oXML.Open ..."
How can I handle this error in vbscript? I want to catch this error and show msgbox with my error, i.e. web page is not available.
There are at least three possible points of failure in your script.
CreateObject may fail; e.g. if you use msxml12 (digit 1) instead of msxml2 (letter l). Such blunders should be fixed during development.
.Open may fail; e.g. if you use "mysite.com" instead of a syntactically correct URL. If you get the URL at runtime, a 'look before you jump' check is advisable, an OERN can be used to catch bad URLs not found by your validation.
.Send may fail; e.g. if the site is down or abandoned. This is a clear case for an OERN.
The most important rule wrt OERN: Keep it local and short (Only one risky line between OERN and OEG0).
Demo code:
Option Explicit
Dim sUrl
For Each sUrl In Split("http://stackoverflow.com http://pipapo.org mysite.com")
Dim oXML, aErr
' Set oXML = CreateObject("msxm12.XMLHTTP")
Set oXML = CreateObject("msxml2.XMLHTTP.6.0")
On Error Resume Next
oXML.Open "GET", sUrl, False
aErr = Array(Err.Number, Err.Description)
On Error GoTo 0
If 0 = aErr(0) Then
On Error Resume Next
oXML.Send
aErr = Array(Err.Number, Err.Description)
On Error GoTo 0
Select Case True
Case 0 <> aErr(0)
WScript.Echo "send failed:", aErr(0), aErr(1)
Case 200 = oXML.status
WScript.Echo sUrl, oXML.status, oXML.statusText
Case Else
WScript.Echo "further work needed:"
WScript.Echo sUrl, oXML.status, oXML.statusText
End Select
Else
WScript.Echo "open failed:", aErr(0), aErr(1)
End If
Next
output:
cscript 24863986.vbs
http://stackoverflow.com 200 OK
send failed: -2146697211 The system cannot locate the resource specified.
open failed: -2147012890 System error: -2147012890.
But your problem is it's msxml2.http (El 2) not msxm12.http (1 2). Yopur error is because you dd not create the object sucessfully or test the object isn't empty.
The URL has to be 100% correct. Unlike a browser there is no code to fix urls.
The purpose of my program is to get error details.
How I get a correct URL is to type my url in a browser, navigate, and the correct URL is often in the address bar. The other way is to use Properties of a link etc to get the URL.
Also Microsoft.XMLHTTP maps to Microsoft.XMLHTTP.1.0. HKEY_CLASSES_ROOT\Msxml2.XMLHTTP maps to Msxml2.XMLHTTP.3.0. Try a later one
Try this way using xmlhttp. Edit the url's etc. If it seems to work comment out the if / end if to dump info even if seeming to work. It's vbscript but vbscript works in vb6.
On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "http://www.microsoft.com/en-au/default.aspx", False
'This is IE 8 headers
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
line =""
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error getting file"
Line = Line & vbcrlf & "=================="
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
Line = Line & vbcrlf & "Source " & err.source
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "HTTP Error " & File.Status & " " & File.StatusText
Line = Line & vbcrlf & File.getAllResponseHeaders
wscript.echo Line
Err.clear
wscript.quit
End If
On Error Goto 0
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile "c:\users\test.txt", 2
Also see if these other objects work.
C:\Users>reg query hkcr /f xmlhttp
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP.1.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.6.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.6.0
End of search: 12 match(es) found.
Also be aware there is a limit on how many times you can call any particular XMLHTTP object before a lockout occurs. If that happens, and it does when debugging code, just change to a different xmlhttp object

Classic ASP msxml3.dll error -2146697211

When trying to call a web service from a classic ASP (not .NET) application I'm receiving a system error I think is related to the server the web application is running on not being able to reach the server the web service is running on.
We're migrating our web services to a new server and my application could reach the old server just fine. This is why I think it's a problem with reaching the new server.
When I extract the error number and description from the Err object I get:
Err.Number = -2146697211
Err.Description = System error: -2146697211
Err.Source = msxml3.dll
Is there a decent way of determining what this error actually means? I'm not an expert in ASP so I don't know what many of the errors mean. If you need more information please let me know.
This uses xml lib. If you are actually connecting to a server, this also gets the server response.
The URL has to be 100% correct. Unlike a browser there is no code to fix urls.
The purpose of my program is to get error details.
How I get a correct URL is to type my url in a browser, navigate, and the correct URL is often in the address bar. The other way is to use Properties of a link etc to get the URL.
Also Microsoft.XMLHTTP maps to Microsoft.XMLHTTP.1.0. HKEY_CLASSES_ROOT\Msxml2.XMLHTTP maps to Msxml2.XMLHTTP.3.0. Try a later one
Try this way using xmlhttp. Edit the url's etc. If it seems to work comment out the if / end if to dump info even if seeming to work. It's vbscript but vbscript works in vb6.
On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "http://www.microsoft.com/en-au/default.aspx", False
'This is IE 8 headers
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
line =""
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error getting file"
Line = Line & vbcrlf & "=================="
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
Line = Line & vbcrlf & "Source " & err.source
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "HTTP Error " & File.Status & " " & File.StatusText
Line = Line & vbcrlf & File.getAllResponseHeaders
wscript.echo Line
Err.clear
wscript.quit
End If
On Error Goto 0
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile "c:\users\test.txt", 2
Also see if these other objects work.
C:\Users>reg query hkcr /f xmlhttp
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP.1.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.6.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.6.0
End of search: 12 match(es) found.
Also be aware there is a limit on how many times you can call any particular XMLHTTP object before a lockout occurs. If that happens, and it does when debugging code, just change to a different xmlhttp object
These are the defined errors.
DHtmled.h:#define DE_E_RESOURCE_NOT_FOUND 0x800C0005
pstore.h:#define PST_E_TYPE_NO_EXISTS _HRESULT_TYPEDEF_(0x800C0005L)
UrlMon.h:#define INET_E_RESOURCE_NOT_FOUND _HRESULT_TYPEDEF_(0x800C0005L)
They all seem to be internet thing doesn't exist.
See my post here on how to decode errors Unknown email code from CDO.Message send method (and there is a new paragraph not on that page reproduced below)
To Decode 0x8019nnnn Errors
HResults with facility 0x19 are HTTP errors. Codes under 16,384 (0x4000) are the same as HTTP errors, eg HTTP status 404: The requested URL does not exist on the server is 0x80190194 (0x194 = 404). Codes 16,384 and higher are BITS specific.

I need help using VBScript to control a commandline program

Using a VBScript (just an example) something like
result = MsgBox ("Would you like to install the AntrixAPI?", vbYesNo, "Installing AntrixAPI")
Select Case result
Case vbYes
MsgBox("The API will be installed.")
Case vbNo
MsgBox("The API will not be install.")
End Select
How could I use this to control a commandline program. Let's say the user selected yes. Then the command would go to a certain point only if the user selected yes.
(example command)
#echo off
:UserSelectedYes
REM This is where the prompt would go if the user selected yes
wget http://www.example.com/thisisafakedomain/api/antrix
:UserSelectedNo
REM This is where the prompt would go if the user selected no
end
Would this be possible?
You can create a MS-DOS process and execute every script, you want!
Just like this:
Dim oProcess As New Process
With (oProcess.StartInfo)
.Arguments = "/k <command> & <command> & <command> & exit"
.FileName = "cmd.exe"
.WindowStyle = ProcessWindowStyle.Hidden
.CreateNoWindow = True
End With
oProcess.Start()
It is not the best and genteelst way, but the fastest.
I do not know exactly, if this is what you wanted. So feel free to redefine your question, it was not very clear what you were asking for!
This is how to download a file in vbscript.
On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "http://www.pepperresources.org/LinkClick.aspx?fileticket=B1doLYYSaeY=&tabid=61", False
'This is IE 8 headers
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
line =""
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error getting file"
Line = Line & vbcrlf & "=================="
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
Line = Line & vbcrlf & "Source " & err.source
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "HTTP Error " & File.Status & " " & File.StatusText
Line = Line & vbcrlf & File.getAllResponseHeaders
wscript.echo Line
Err.clear
wscript.quit
End If
On Error Goto 0
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile "c:\users\test.txt", 2
Your VBScript can be as simple as this:
WScript.Quit MsgBox("Would you like to install the AntrixAPI?", vbYesNo, "Installing AntrixAPI")
Call it from your batch file and test the return value. vbYes has a value of 6, vbNo has a value of 7.
#echo off
cscript c:\test.vbs
if %errorlevel%==6 goto UserSelectedYes
if %errorlevel%==7 goto UserSelectedNo

Can't retrieve Web page via VBScript unless opened in browser first

I want to retrieve and process some Web pages with VBScript, which is being run from the command line. It bears mentioning that I'm on a work computer, and "some setting are managed by your system administrator". Also, I log in to the computer with a CAC, so (and I think this is the problem) there are certificates involved.
My problem is that, frequently, when I run the VBScript I'll get back a 401/unauthorized error, for both HTTPS and non-HTTPS sites. If I then open the URL in a browser, the script (still being run from the command line) will work. If I run the script on my home computer I can always access any URL without first having to open it in a browser. So, I'm guessing it has to do with either the certificates in my CAC (which are also installed on the computer), or some other certificate on the computer, that are used to authenticate the connection (or some such thing).
My question is: how can I retrieve various Web pages using VBScript (without installing any additional software) without having to first open the URL in a browser to get the script to work?
Here is my code for getting a Web page, if that helps:
function getWebPage(sURL)
dim iErrorCount
on error resume next
'******************
'ERROR CHECKING OFF
'******************
oHTTP.Open "GET", sURL, False
oHTTP.Send
if (err.number <> 0) then
iErrorCount = 0
do
iErrorCount = iErrorCount + 1
log "log.txt", "Error retrieving Web page. Error #0x" & hex(err.number) & ". Description: " & err.description, 0, true
if (iErrorCount = 5) then
log "log.txt", vbTab & "Five successive errors retrieving Web page. Exiting...", 1, true
msgbox "ERROR: Five successive errors retrieving " & chr(34) & sURL & chr(34) & vbCRLF & vbCRLF & "See the log file for details." & vbCRLF & vbCRLF & "Exiting...", vbOkOnly, programName
log "last result.html", oHTTP.ResponseText, 0, false
wscript.quit
else
wscript.sleep iErrorCount * 60000
set oHTTP = nothing
set oHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
oHTTP.Open "GET", sURL, False
oHTTP.Send
end if
loop until (err.number = 0)
end if
on error goto 0
'*****************
'ERROR CHECKING ON
'*****************
if (oHTTP.Status <> 200) then
log "log.txt", vbcrlf & vbtab & "Error retrieving Web page" & vbcrlf & vbtab & "URL: " & sURL & vbcrlf & vbtab & "Status: " & oHTTP.Status & vbcrlf & vbtab & "Description: " & oHTTP.statusText, 1, true
msgbox "ERROR: Cannot retrieve Web page." & vbCRLF & vbCRLF & "See the log file for details." & vbCRLF & vbCRLF & "Exiting...", vbOkOnly, programName
wscript.quit
else
' log "last result.html", oHTTP.ResponseText, 0, false
getWebPage = oHTTP.ResponseText
end if
end function
Any thoughts?
You have to get the url exactly right with xmlhttp object. Run this code and print out the error messages (you can copy a messagebox with Ctrl + C).
Set fso = CreateObject("Scripting.FileSystemObject")
Set Outp = Wscript.Stdout
On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "ftp://ftp.microsoft.com/Softlib/README.TXT", False
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.Send
If err.number <> 0 then
line =""
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error getting file"
Line = Line & vbcrlf & "=================="
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " & err.description
Line = Line & vbcrlf & "Source " & err.source
Line = Line & vbcrlf & ""
Line = Line & vbcrlf & "HTTP Error " & File.Status & " " & File.StatusText
Line = Line & vbcrlf & File.getAllResponseHeaders
wscript.echo Line
Err.clear
wscript.quit
End If
On Error Goto 0
Set BS = CreateObject("ADODB.Stream")
BS.type = 1
BS.open
BS.Write File.ResponseBody
BS.SaveToFile "c:\users\safetyscanner.exe", 2

Resources