I am new to the LWP::UserAgent module and also in fact to object 
programming. I am currently writing a simple HTTP client.

I am using the LWP::UserAgent module and everything works fine apart from 
that I do not manage to access the headers of the respons message:

The page I access include a redirection (ie Location: http://url..).
I use the following to save down all of the respons into a file:

open (xyz,">cjbfiles/file.txt");
print xyz $page->code;
print xyz $page->message;
print xyz $page->content;
close(xyz);

This works fine, all the content is included in the file together with the 
code and message.

However when I include the following
print xyz $page->headers_as_string();
what happens is that the file include the content and headers of the 
"redirection page" and not of the first page which included the Location: 
header.

And when I use this instead:
print xyz $page->headers;
The header show up in some hexadecimal form.

This confuses me a lot. I really want to access every available data in the 
first page which includes the Location header and NOT the content of the 
redirected page.

I use this for the actual request:
  my $page = $ua->simple_request($req);
so the agent should not proceed to the redirection page.

Can someone please help? How do I access the headers of the first page?

Erik

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Reply via email to