in reply to File downloader

As tachyon and atcroft pointed out, you can use LWP::Simple. However I have a situation where I have to send cookie along with the request. In that case, LWP::Simple does not help any more, and I use LWP::UserAgent:

use LWP::UserAgent; use HTTP::Request; use strict; use warnings; my $ua = LWP::UserAgent->new(); my $request = HTTP::Request->new(GET => "http://blah.com/attachmen +t.php?attachmentid=123"); $request->header("Cookie", 'a=1; b=2; c=3'); my $content = $ua->request($request)->content(); open(FILE, ">", "foo.jpg"); binmode(FILE); print FILE $content; close FILE;