Torbj�rn Lindahl <[EMAIL PROTECTED]> writes:

> hello, can anyone tell me how to extract headers received from the
> response object received useing LWP::UserAgent?
> 
> i have looked through the functions on this page:
> http://www.perldoc.com/perl5.6.1/lib/LWP.html#The-Response-Object
> 
> but cant seem to find what i need.

You should instead look at:

http://www.perldoc.com/perl5.6.1/lib/HTTP/Response.html
http://www.perldoc.com/perl5.6.1/lib/HTTP/Message.html
http://www.perldoc.com/perl5.6.1/lib/HTTP/Headers.html

The short story is that you use:

  my $field_value = $res->header("Foo");

> In my specific case i receive a cookie that i need to pick up and some
> redirectinoal headers.

  my $cookie = $res->header("Set-Cookie");
  my $loc = $res->header("Location");

but LWP also has ways to deal with this stuff automatically, by
associating a cookie_jar with the user agent and transparent
refetching on redirects.

Regards,
Gisle

Reply via email to