Take the 2-minute tour ×
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: 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.

share|improve this question
add comment

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
share|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
add comment

Your Answer

 
discard

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.