How to translate wget command with custom header to vbscript or javascript?

goaliebob99

New Member
For my html application I need to download JDK directly. This wget command seems to work for it\[code\]wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz" \[/code\]How can I translate this wget which is sending a custom header to ideally a vbscript line ( I prefer vbscript but will settle for javascript if i have to). P.S. I think the--no-cookies is optional but not sure. The reason I can't use a direct download link is that oracle requires users to click Accept Agreement on the download page below.This link is for the latest download HTML pagehttp://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.htmland this is the latest direct .exe link ( once you have clicked ACCEPT AGREEMENT)
http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-windows-x64.exe Or any other way to bypass the Accept Agreement problem?This is my vbscript code which *gives an "unspecified error"*on line 4 with the \[code\]setRequestHeader\[/code\]. the value ine gpw_e24 I tried the value i gave above too, didnt work.\[code\]Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")URL="http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-windows-x64.exe"saveto="c:\java.exe" objXMLHTTP.setRequestHeader "Cookie", "gpw_e24=http%3A%2F%2Fwww.oracle.com"objXMLHTTP.open "POST", URL, falseobjXMLHTTP.send()If objXMLHTTP.Status = 200 ThenSet objADOStream = CreateObject("ADODB.Stream")objADOStream.OpenobjADOStream.Type = 1 'adTypeBinaryobjADOStream.Write objXMLHTTP.ResponseBodyobjADOStream.Position = 0 'Set the stream position to the startSet objFSO = Createobject("Scripting.FileSystemObject")If objFSO.Fileexists(saveTo) Then objFSO.DeleteFile saveToSet objFSO = NothingobjADOStream.SaveToFile saveToobjADOStream.CloseSet objADOStream = NothingEnd ifSet objXMLHTTP = Nothing' DoneWScript.Quit\[/code\]
 
Back
Top