I want to return just the server headers from the response of a http post. Here is the code I am using.
#!/usr/bin/perl use LWP::UserAgent; use Data::Dumper; my $ua = LWP::UserAgent->new( Timeout => 5, agent => "test" ); my $res = $ua->post( "http://www.microsoft.com/cgi-bin/login.cgi" ); print Dumper( $res->headers );
And this is what it returns:
$VAR1 = bless( { 'link' => [ '</library/Errorpages/mnp_utility.mspx/te +mplatecss?template=%2flibrary%2fgallery%2ftemplates%2fMNP2.SiteMap&sh +ell=%2flibrary%2ferrorpages%2fconfig%2fen-us.config&locale=en-us>; re +l="Stylesheet"; type="text/css"', '</library/mnp/2/aspx/css.aspx?locale=en- +us&static=Page>; /="/"; rel="Stylesheet"; type="text/css"', '</library/toolbar/3.0/css.aspx?c=/librar +y/errorpages/config/en-us.config>; /="/"; rel="stylesheet"; type="tex +t/css"' ], 'x-powered-by' => 'ASP.NET', 'client-response-num' => 1, 'cache-control' => 'private', 'date' => 'Thu, 12 Oct 2006 20:15:47 GMT', 'x-meta-search.mnp.template' => 'MNP2.SiteMap', 'client-peer' => '207.46.19.30:80', 'content-length' => '16401', 'x-aspnet-version' => '2.0.50727', 'p3p' => 'CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo +IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"', 'client-date' => 'Thu, 12 Oct 2006 20:15:46 GMT', 'content-type' => 'text/html; charset=iso-8859-1', 'title' => "We\x{2019}re sorry, the page you requeste +d could not be found", 'server' => 'Microsoft-IIS/6.0' }, 'HTTP::Headers' );
Why has it got everything in there, including the title of the document, stylesheet link, etc, etc ?

In reply to Using LWP::UserAgent for http post... Abnormal headers returned by vancetech

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.