Monday, January 02, 2006

Download Oracle XE with wget

I needed to download Oracle XE using wget mainly because of the limit rate option, but also because i can run it in the background and files can be resumed at any time. The limit rate option allows me to not use almost all the available Internet bandwidth, so i tried to download it but i noticed that you can't get the file directly from (this link is for windows platforms) without beeing authenticated, you must have a cookie if you already signed in, otherwise you will be forwarded to, where there is a form asking for username and password that post to sending this and other additional variables for authentication and finally redirection to the url that we came from (as you can se below in the redirectUrl variable) that in this case was the file to download.

If we look at the talk between browser and server when sending the form we can see the POST variables :

POST /jsp/reg/loginHandler.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Accept: text/xml,application/xml,application/xhtml+xml,
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
OracleXE.exeCookie: JSESSIONID=8d920d0fce90b20ff91eaec4cc2aa
OXgnkrDqRfMmlfDpQSxn6jAmljGr5XDqQLvpAe_;s_cc=true; s_sq=orac
Content-Type: application/x-www-form-urlencoded
Content-Length: 324


with that POST variables and URL i compose the following
wget command:

wget -v -c --limit-rate=3K --no-check-certificate --post-data="remoteIp=63.XXX.XX.XX&globalId=&redirectUrl=" -o oraxe.log &

-c , is used when you are resuming the download
--limit-rate=3K, limit to 3 Kbytes/sec
--no-check-certificate, it doesnt work verifying the server
-o oraxe.log, for output
& to run on background

At the end of the POST variables you can find "...username=camafla&password=xxxxx..." , you have to change
that with your personal information (also remoteIp=63.XXX.XX.XX).

The redirectUrl= variable may change but you just have to check with a browser whats the actual url.


Laurent Schneider said...

> If we look at the talk between browser and server


carlos mafla said...

I use the
live HTTP headers extension
, it lets you watch the request/response messages between browser and server.

Laurent Schneider said...

ok, thanks for the hint, even if it is not as convenient as wget --load-cookies, it is still a good thing to know, just in case load-cookies will stop working one day...

Anonymous said...

Is there a plugin for konqueror?

carlos mafla said...

I'm sorry, I don't think so. At least not live http headers extension. Why would you use konqueror anyway?.

Anonymous said...

Man, really thanks a lot!

Anonymous said...

There is another way to do this that I found. You might find it easier or not. I was forced to use the command line to download XE and was at a quandry of how to do it. I tried lynx 3 times and was not getting anywhere. I finally used linx to get past the login screen and start the download process, then I opened a new ssh window in the same session and used wget to pull the rpm directly. Since I was already authenticated, it downloaded the file directly.

For me it was faster than forming a key value url string.

Anonymous said...

Thank you, I had the same problem and your solution was very useful.

iron gates said...
This comment has been removed by a blog administrator.
Joel said...
This comment has been removed by the author.
Joel said...

some reason the url in the message I was trying to post didn't show up properly - ignore the previous post.

Imre said...

get parameters work as good:

just replace XXX-s and file url

wget.exe -c --no-check-certificate ""

Patschius said...

many thx!