printing the redirections responses

Hi,

I have tried:

use LWP::UserAgent;

my $url = "https://www.server.com/";

my $ua = LWP::UserAgent->new(env_proxy => 0,
timeout => 200,
keep_alive => 1,
);

my $request = HTTP::Request->new('GET', $url);

my $response = $ua->request($request);

print $response->as_string();

---

The response is the final page, even though there is a redirection until
this page is returned. Is it possible to get and print that redirect HTTP
header?

Thank you.

Teddy
orasnita [ Do, 21 Juli 2005 08:19 ] [ ID #889536 ]

Re: printing the redirections responses

"Octavian Rasnita" <orasnita [at] fcc.ro> writes:

> my $response = $ua->request($request);
> print $response->as_string();

[...]

> The response is the final page, even though there is a redirection until
> this page is returned. Is it possible to get and print that redirect HTTP
> header?

Just use $ua->simple_request() instead of $ua->request() to dispatch
the request.

--Gisle
gisle [ Do, 21 Juli 2005 14:53 ] [ ID #889537 ]
Perl » perl.libwww » printing the redirections responses

Vorheriges Thema: Bug in cookies in libwww-perl-5.803
Nächstes Thema: Problem with <SELECT MULTIPLE> in Mech (maybe in HTTP::Form as well?)