For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > February 2007 > To get the HTTP response headers such as content length from a web server









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author To get the HTTP response headers such as content length from a web server
dhawangayash@gmail.com

2007-02-23, 8:04 am

I would like to use Perl to help me download some files by using the
curl command like this

system("curl https://www.foo.com/ -o ~/sample/Test.exe");

I need to fasten this process by simultaneously running three threads
that run the same curl command but different parts of the file. Hence
speeding up the process.

But for this I need to find the size of the file that needs to be
downloaded I thought that by getting the HTTP response for the
particular GET request I shall get the file size.

Can somebody help me how to go about with this........

Tad McClellan

2007-02-23, 8:04 am

dhawangayash@gmail.com <dhawangayash@gmail.com> wrote:

> Subject: To get the HTTP response headers such as content length from a web server


use the LWP::Simple module:

perl -MLWP::Simple '(undef, $len) = head "http://www.foo.com"; print $len'

> I would like to use Perl to help me download some files by using the
> curl command like this



You can download them with native Perl, no need for curl...


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com