When I do an http Post (as below) or even a get after logging into to a protected page the output is an HTTP 303. How do I handle the redirect with my web client script so that my script goes right to the url in the location header of the 303 response? Do I also need to do something special so that my web session remains open and I won't need to re-login to grab the page I'm redirected to?
package default_web; require LWP; require LWP::Debug; @ISA = qw(LWP::UserAgent); my $netloc; my $realm; my $uname; my $pass; my $web_url; # Create the user agent object $ua = default_web->new; #pretend these are defined $ua->credentials($netloc, $realm, $uname, $pass); # Set up a request. We will use the same request object for all URLs. $request = HTTP::Request->new(POST => 'http://192.168.1.254/Forms/MyAc +countConfirm'); $request->content_type('application/x-www-form-urlencoded'); $request->content('NST_1stWANPortAuthName=user&NST_NewPassword=pwd&NST +_RepeatPassword=pwd'); # Send the request and get a response back from the server $response = $ua->request($request); print $response->as_string;

In reply to libwww and grab redirect by jweden

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.