Results 1 - 10 of about 194,000 for Perl How To Fetch Last Modified Header Information
LOL, just curious if this post will get ranked for it's Title.

Even though I've been coding perl for about 5 years, I didn't know how to get just the
Header information until recently. Probably cuz I had no reason to get it, lol. I mean, I
started in perl writing just perl/cgi's for a small IRC web site, I didn't have need for much else
than parsing some form data.
Over the last year or so, I have found reason, (one if for the pure fun of it), to use more
and more perl; namely LWP, (perl's browser imitator).
Perl's
use LWP::Simple Head function returns five values in a list. Here's my snippet. Tear it
apart, add to it, whatever.....
#!/usr/bin/perl
use LWP::Simple;
print "Content-type: text/html\n\n";
$|=1;
$url = 'technorati.com';
# USE 'HEAD' TO GET JUST THE HEADERS OF THE URL
($content_type, $document_length, $modified_time, $expires, $server) = head($url);
# CONVERT THE EPOCH TIMES, (number of seconds since perk was born

, TO A NORMAL DATE FORMAT
$lastmod_date = gmtime($modified_time);
$expires_date = gmtime($expires);
print "Fetching Headers -> $url... <BR>\n";
print "Last Modified: $lastmod_date GMT <BR>\n";
print "Content Type: $content_type <BR>\n";
print "Length: $document_length <BR>\n";
print "Expires: $expires_date <BR>\n";
print "Server: $server<P>\n\n";
Just upload to cgi-bin, (many hosts no longer require this), change permissions to 755 and
point your browser to your URL.
Bompa