Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I have a URL similar to this:

How do I download the file using wget? Everytime I try I always end up downloading the php file.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The php file you downloaded with wget is actually a zip file with php extensions. Rename the file extension and you'll be able to extract the contents normally.

wget saves the file with the same name as the filename in the URL by default. To set the output name, see @bfhd`s comment.

For a case where you need to POST authentication information, you can do the following, which is extracted from StackOverflow: How to use wget post data

# Log in to the server.  This can be done only once.                   
wget --save-cookies cookies.txt \
     --post-data 'user=foo&password=bar' \

# Now grab the page or pages we care about.
wget --load-cookies cookies.txt \
share|improve this answer
You can also do "wget -O"; which will rename the file for you. – bfhd Oct 10 '11 at 0:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.