[Techtalk] download_script.php with wget

Conor Daly c.daly at met.ie
Tue Jan 11 21:21:09 EST 2005


On Mon, Jan 10, 2005 at 05:26:50PM -0600 or thereabouts, Gretchen Dziengel wrote:
> When I have some down time at work, I log in to my home computer to play
> around with Linux stuff.  Lots of times I like to download files to my
> home computer with wget.  Works great most of the time.  I copy the link
> right into putty.  The problem is with urls such as:
> http://www.vim.org/scripts/download_script.php?src_id=3576
> 
> That downloads a file called "download_script.php?src_id3576"  That file
> is not the file I've tried to download either.
> 
> I've googled and checked the wget mail archives but I'm not sure if I'm
> using the correct search terms.  Can anyone give me a hint on how to
> handle this?  More and more sites seem to be doing it.

This looks like raw http header generation.  There's some info at:
http://ie2.php.net/Header

specifically:

#######################
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?> 
#######################

Your browser (or wget) will see:

'Content-type: application/pdf'
'Content-Disposition: attachment; filename="downloaded.pdf"'

and should attempt to handle that.  It looks like wget is not the tool for
this.  OTOH, lynx handles it perfectly.  I just did:

 # lynx --dump http://www.vim.org/scripts/download_script.php?src_id=3576 > test.zip
 # file test.zip
test.zip: Zip archive data, at least v1.0 to extract
 # unzip -l test.zip
Archive:  test.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  10-23-04 11:14   Viki/
        0  10-23-04 11:14   Viki/compiler/
      947  08-19-04 16:10   Viki/compiler/deplate.vim
        0  10-23-04 11:14   Viki/doc/
    34928  10-15-04 08:15   Viki/doc/viki.txt
        0  10-23-04 11:14   Viki/etc/
      174  10-26-04 15:00   Viki/etc/Viki.lst
        0  10-23-04 11:14   Viki/ftplugin/
        0  10-23-04 11:14   Viki/ftplugin/bib/
      344  07-28-04 16:21   Viki/ftplugin/bib/viki.vim
     1120  10-13-04 17:39   Viki/ftplugin/viki.vim
        0  10-23-04 11:14   Viki/indent/
     3023  10-20-04 17:22   Viki/indent/viki.vim
        0  10-23-04 11:14   Viki/plugin/
    48957  10-21-04 19:10   Viki/plugin/viki.vim
     4695  09-12-04 06:54   Viki/plugin/vikiLatex.vim
        0  10-23-04 11:14   Viki/syntax/
     5879  10-18-04 18:49   Viki/syntax/viki.vim
 --------                   -------
   100067                   18 files



Conor
-- 
Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +3531 8064276 Fax +3531 8064247


**********************************************************************
This e-mail and any files transmitted with it are confidential 
and intended solely for the addressee. If you have received
this email in error please notify the sender.
This e-mail message has also been scanned for the
presence of computer viruses.
**********************************************************************



More information about the Techtalk mailing list