If I have a URL similar to this: http://www.vim.org/scripts/download_script.php?src_id=11834

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

link|improve this question

40% accept rate
feedback

1 Answer

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' \
     http://server.com/auth.php

# Now grab the page or pages we care about.
wget --load-cookies cookies.txt \
     -p http://server.com/interesting/article.php
link|improve this answer
2  
You can also do "wget -O zipfile.zip vim.org/scripts/download_script.php?src_id=11834"; which will rename the file for you. – bfhd Oct 10 '11 at 0:14
feedback

Your Answer

 
or
required, but never shown

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