OK, here is what I did:

First at the beginning of my program I have:

$agent->requests_redirectable( [] );


Now here is where I click a continue button that loads the page that is supposed to redirect me to the final page (note that redirects are disabled and I am retrieving and then GETing the redirect URL manually):

$post_response = $agent->click('continue'); my $status = $agent->status(); if (($status >= 300) && ($status < 400)) { my $location = $agent->response()->header('Location'); if (defined $location) { print "Redirected to $location\n"; $post_response = $agent->get(URI->new_abs($location, $agent->b +ase())); printf("post_response is %s\n", $post_response->status_line); } }
This seems to successfully capture the redirect URL and outputs the following (actual long hex strings and other info replaced with 'X'):
Redirected to /misc/XXXX/processocp.cgi?email=XXXX&back=httpXXXXX&spla +sh=X&vskey=XXXX post_response is 200 OK
However I can tell from my program that is isn't successfully navigating to the final screen of the process, because when I run:
$post_response->decoded_content()
I get (again, the info in the redirect URL has been replaced with 'X'):
<!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <meta http-equiv="refresh" content="1;url=http://XXXX/processocp.cgi?e +mail=XXXXX&back=XXXXXX&vskey=XXXXX"> </head> <body> <div style="font-size: 1.5em; text-align: center; width: 300px; margin +: 0px auto; margin-top: 40px"> Processing...please wait<br/> </div> </body> </html>


As you can see, it still seems to be stuck at the "processing.." screen, even though I told the program to "get" the redirect URL, i.e. the URL that would normally be automatically retrieved if redirects were enabled.

What is going on here?

In reply to Re^3: redirection issue with WWW::Mechanize by Special_K
in thread redirection issue with WWW::Mechanize by Special_K

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.