Hi Guys
Hoping someone may be able to help me. I'm trying to write a script to automatically download a file once a day from a site. It's a zipped csv file, usually around 6mb. The site is slow!
When i first hit the URL from my script a 303 response is returned which seems to be redirecting to a login page. However if I manually paste the url directly into a browser the file downloads ok (200 response).
Can anyone help me get to the bottom of this please?
Thanks
~S~
Hoping someone may be able to help me. I'm trying to write a script to automatically download a file once a day from a site. It's a zipped csv file, usually around 6mb. The site is slow!
When i first hit the URL from my script a 303 response is returned which seems to be redirecting to a login page. However if I manually paste the url directly into a browser the file downloads ok (200 response).
Can anyone help me get to the bottom of this please?
Code:
set xHttp=createObject("Microsoft.XMLHTTP")
xHttp.Open "GET","[URL unfurl="true"]http://xxxx.com/index.sjs?SomeParams,false[/URL]
xHttp.Send
strFilename="C:\testfile.zip"
if xHttp.status=200 then
set bStrm=CreateObject("ADODB.Stream")
with bStrm
.type=1
.open
.write xHttp.responseBody
.saveToFile strFilename,2
.close
end with
set bStrm=nothing
else
msgbox "Could not access server"
end if
set xHttp=nothing
set fso=CreateObject("Scripting.FileSystemObject")
if fso.fileexists(strFilename) then
msgbox "Saved '" & strFilename & "' - successful"
else msgbox "Something went wrong"
end if
set fso=nothing
Thanks
~S~