Re: Query Online File Size

2009-11-26 Thread Giany
use LWP::UserAgent; sub GetFileSize{ my $url=shift; $ua = new LWP::UserAgent; $ua->agent("Mozilla/5.0"); my $req = new HTTP::Request 'HEAD' => $url; $req->header('Accept' => 'text/html'); $res = $ua->request($req); if ($res->is_success) {

Query Online File Size

2009-11-26 Thread raphael()
Hi, I am writing a small script to download files of the web. How can I get the "file size" without downloading the file? use LWP::Simple; my $file = "http://www.abc.com/file.mp3"; my @array = head($file); print "$array[1]\n"; head() doesn't always returns all values? why?? Sometime there are a