Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I want to login somewhere to get the state of my account.
The address of this acct.-page is just
https://myaccount.server.com/clx/index.php?part=menu&justloggedin=true
I use WWW::Mechanize, but I end up at a page with
<meta http-equiv="Refresh" content="0;url=index.php?part=menu&justloggedin=true">
Now I either loose the session, or I just reload exatly this page.
How, the hell, can I go beyond this page, which shows I am successfully logged in
  use WWW::Mechanize;     my $m = WWW::Mechanize->new( agent => 'Linux Konqueror' );     $m->get( $url );     $r = $m->success or die "Can't get this url $url\n\n";     # login-Page is loaded ..     my $r = $m->submit_form(         fields      => {             $uFld    => $uNme,             $pFld    => $pPwd         }     );     die "Couldn't submit form" unless $r->is_success;     # Login was successfull here print $r->content # prints this #<html><head> #<meta http-equiv="Refresh" #content="0;url=index.php?part=menu&justloggedin=true"> #</head><body><a #href="index.php?part=menu&justloggedin=true"></a></body></html>
If I do these I loose the session (need to re-login):
$m->follow_link(n=>0); $m->follow_link(n=>1);
If I try to create the url by my self by
Step 1:
print join('; ',@{${$m->links()}[0]}),"\n\n"; print join('; ',@{${$m->links()}[1]}),"\n";
this gives me:
index.php?part=menu&justloggedin=true; ; ; meta; https://myaccount.ser +ver.com/clx/index.php; HASH(0x864c5f8) index.php?part=menu&justloggedin=true; ; ; a; https://myaccount.server +.com/clx/index.php; HASH(0x86168bc)
So I just try:
$m->get( 'https://myaccount.server.com/clx/index.php?part=menu&justlog +gedin=true' )
and the session is lost => re-login

And even what I have found on Active bugs for WWW-Mechanize (http://rt.cpan.org/Public/Bug/Display.html?id=12882)

print $m->response->request->uri;
shows: https://myaccount.server.com/clx/index.php
and that only reloads the first login-form and not what I want.

If I do a reload after submitting the form,
$m->reload();
I just reload meta="Refresh.. page


Anybody with an idea how I can get beyond this "meta-page"?

Thanks a lot in advance;
Carl

Replies are listed 'Best First'.
Re: meta="Refresh"
by perrin (Chancellor) on Nov 22, 2006 at 14:23 UTC
    You need to load the URL from the META tag, just like a browser would.
      Well, I tried, but then I loose the session and I have
      to do the login again.
        How can you tell you lost the session?
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re: meta="Refresh"
by Anonymous Monk on Nov 22, 2006 at 14:03 UTC
    We'll need the real url, your login, and password.