One thing I find useful when comparing the behavior of my browser to the behavior of a LWP::UserAgent object is to configure the object so that it mimics a real browser, because some servers will respond differently depending on the type of browser they think they are dealing with, and can be particularly unhelpful if they think they're dealing with a robot. (Yes: anti-mecha discrimination is rampant.) Try something like:

$ua->agent( 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/2 +0050223 Firefox/1.0.1' );
See the agent parameter in the docs for LWP::UserAgent. (BTW, the code given above works as-is even if you are using LWP::Simple, as long as you import the package variable $ua from LWP::Simple.)

To determine what string to use, for Firefox I use the very handy Live HTTP headers.

the lowliest monk


In reply to Re: LWP::UserAgent and no cookies in my response? by tlm
in thread LWP::UserAgent and no cookies in my response? by bageler

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.