Created
May 9, 2013 13:58
-
-
Save ozuma/5547584 to your computer and use it in GitHub Desktop.
Get HTTP Response Headers as string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
my $ua = LWP::UserAgent->new; | |
$ua->agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:20.0) Gecko/20100101 Firefox/20.0"); | |
my $req = HTTP::Request->new(GET => 'http://www.example.com/'); | |
my $res = $ua->simple_request($req); | |
print $res->headers_as_string; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment