Wget is not working properly.

I have doubts about the wget command. This is what I want to achieve. I want to download the tar package from this link "http://snapshots.linaro.org/oneiric/lt-origen-oneiric/20120321/0/images/hwpack/hwpack_linaro-lt-origen_20120321-0_armel_supported.tar.gz". This link works fine when I use it in the browser to download the package, but when I use the same link to download it through the wget command, it redirects to "http://snapshots.linaro.org/licenses/samsung- v2 .html ", which is a license agreement and instead of downloading a tar file, downloads the license agreement file. So, what option should I provide for it to download the desired tar file and license agreement file. Please help me in this matter.

0
source share
1 answer

You must replicate using wget the same actions as in a web browser. The first step is to see what HTTP requests are executed when you request a license page, and a confirmation button.

You can use firebug or livehttpheaders for this . When you have the urls (with post / get param options), you can reproduce it with a shell script and several wget calls.

If the website is tracking cookies, you need to instruct wget to save them in the cookiejar and use the specified cookiejar for further requests.

In your case, the first request

GET /oneiric/lt-origen-oneiric/20120321/0/images/hwpack/hwpack_linaro-lt-origen_20120321-0_armel_supported.tar.gz HTTP/1.1

for which you receive a cookie and redirect

Set-Cookie: downloadrequested=/oneiric/lt-origen-oneiric/20120321/0/images/hwpack/hwpack_linaro-lt-origen_20120321-0_armel_supported.tar.gz; path=/; domain=.snapshots.linaro.org
Location: http://snapshots.linaro.org/licenses/samsung-v2.html

when you press the confirmation button

GET /licenses/samsung-accepted.html HTTP/1.1

cookie ( )

Set-Cookie: samsunglicenseaccepted-v1=true; path=/oneiric/lt-origen-oneiric/20120321/0/images/hwpack/; domain=.snapshots.linaro.org; expires=Wed, 21-Mar-2012 17:37:57 GMT
Location: http://snapshots.linaro.org/oneiric/lt-origen-oneiric/20120321/0/images/hwpack/hwpack_linaro-lt-origen_20120321-0_armel_supported.tar.gz
+2

All Articles