M
Martin Kissner
hello together,
I want to capture all HTTP headers a webserver sends for a website using
LWP. I have checked perldoc LWP and perldoc LWP::Simple but did't find
anything helpful.
Gogle also didn't bring me any further.
I tried this script giving th URL as an argument (i.e.
http://www.google.com)
---
i#!/usr/bin/perl
use warnings;
use strict;
use LWP;
my $url = shift;
my $agent = LWP::UserAgent->new;
my $request = HTTP::Request->new(HEAD => $url);
my $response = $agent->request($request);
print $response->content;
print $response->header("Content-type"),"\n";
---
I thought the content of a HEAD request would be all header but
obviously that is wrong. If I know the specific header (here
Content-type) I get the value of it. But I want to get *all* headers.
The function head($url) of LWP::Simple only returns the following 5
values: "$content_type, $document_length, $modified_time, $expires,
$server".
How can I capture all headers of a HTTP Request using LWP?
Thanks in advance.
Best regards
Martin
I want to capture all HTTP headers a webserver sends for a website using
LWP. I have checked perldoc LWP and perldoc LWP::Simple but did't find
anything helpful.
Gogle also didn't bring me any further.
I tried this script giving th URL as an argument (i.e.
http://www.google.com)
---
i#!/usr/bin/perl
use warnings;
use strict;
use LWP;
my $url = shift;
my $agent = LWP::UserAgent->new;
my $request = HTTP::Request->new(HEAD => $url);
my $response = $agent->request($request);
print $response->content;
print $response->header("Content-type"),"\n";
---
I thought the content of a HEAD request would be all header but
obviously that is wrong. If I know the specific header (here
Content-type) I get the value of it. But I want to get *all* headers.
The function head($url) of LWP::Simple only returns the following 5
values: "$content_type, $document_length, $modified_time, $expires,
$server".
How can I capture all headers of a HTTP Request using LWP?
Thanks in advance.
Best regards
Martin