Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How do I download a file retrieved via a GET request? I tried wget http://www.example.com/?page=download&dl=123 and wget http://www.example.com/dl.php?dl=123, but they don't work. Going to the URLs in a browser works fine, but wget and curl don't. How can I download the file from the command-line?

share|improve this question
The ?a=b&c=d format is GET. POST sends data hidden in the request, not the URL. – Kevin Feb 9 '12 at 4:18
Have a look at this SO answer for curl: stackoverflow.com/a/2348370/900873 – Kevin Feb 9 '12 at 4:24
1  
Be on the safe side, 'single-quote' the URLs because ? and & are usually special to the shell. (Really, "doesn't work" is a little unspecific.) – Ulrich Schwarz Feb 9 '12 at 5:33
hmmm.... Ulrich Schwarz, ure right, i didnt realize it but wget does get the file, its just that it had the file name as dl.php?page=download&dl=123 so i thought it was not it but thats how wget saves files... – krack krackerz Feb 9 '12 at 6:39
I wonder if --trust-server-names helps. I never tried it (but I will, next time I have this issue) — according to the man page, it trusts the server-provided filename, which is what you want. Whether that is secure or not, I don't know, let's hope wget does some sanity check before using the name. – njsg Feb 9 '12 at 10:37

closed as too localized by Michael Mrozek Feb 9 '12 at 14:40

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.