#! /usr/bin/perl -w use strict; use warnings; use LWP::Debug qw(+); #for debugging info use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use HTTP::Date; # Create a user agent that uses the proxy info from the environment my $ua = LWP::UserAgent->new(env_proxy=>1); # Create the request my $request = HTTP::Request->new('GET'=>'http://www.perlmonks.com/'); # Add the If-Modified-Since header $request->push_header (if_modified_since=>time2str(time)); #Submit your request my $response = $ua->request($request); if ($response->is_success) { print "Retrieved URL OK\n"; } else { print $response->status_line . "\n"; }