Mechanize && meta="Refresh"
Mechanize && meta="Refresh"
am 23.11.2006 10:21:54 von gooly
Hi,
How do I get beyond the that meta=3D"Refresh" page.
I konw the answer of Andy Lester in the archive, that
"The address of the META REFRESH should be available to you in the
$mech->links() method."
Yes it is - as you can see below, but how should I use it, all what I=20
tried either=20
loads again the login-page to start again or
loads again that meta-page or=20
looses the session, so re-login is required
So how shall I do it?=09
My little piece of code using WWW::Mechanize that logs me in is just:
use WWW::Mechanize;
my $mech =3D WWW::Mechanize->new( agent =3D> 'Linux Konqueror' );
$mech->get( 'https://acct.server.com/clx/index.php?part=3Dlogoff&noclos=
e=3Dtrue' );
$mech->success or die "Can't get this url $url\n\n";
# ok, got the login page..
my $r =3D $mech->submit_form(
fields =3D> {
$uFld =3D> $uNme,
$pFld =3D> $pPwd
}
);
die "Couldn't submit form" unless $r->is_success;
# ok, being here, submit was successfull
# and this is what I've got
=A0 =A0 print $r->content # prints this
=A0 =A0 =A0 #
=A0 =A0 =A0 #
=A0 =A0 =A0 #content=3D"0;url=3Dindex.php?part=3Dmenu&justloggedin=3Dtru e">
=A0 =A0 =A0 #
=A0 =A0 =A0 #href=3D"index.php?part=3Dmenu&justloggedin=3Dtrue">=
=A0If I do one of these:
=A0 =A0 $mech->follow_link(n=3D>0);
=A0 =A0 $mech->follow_link(n=3D>1);
I loose the session (need to re-login) and get:
#
#
ut">
#
#Session lost
#
#Click here to go back to the login pa+ge
#
=A0If I try to create the url by myself by
=A0Step 1:=20
=A0 =A0 print join('; ',@{${$mech->links()}[0]}),"\n\n";
=A0 =A0 print join('; ',@{${$mech->links()}[1]}),"\n";
gives me for [0] the mate-url:=20
# index.php?part=3Dmenu&justloggedin=3Dtrue; ; ; meta;
# https://acct.server.com/clx/index.php; HASH(0x864c5f8)
and for the second url at [1]
# index.php?part=3Dmenu&justloggedin=3Dtrue; ; ; a;
# https://acct.server.com/clx/index.php; HASH(0x86168bc)
So I just try:=20
$mech->get( 'https://acct.server.com/clx/index.php?part=3Dmenu&justlogg=
edin=3Dtrue' )
and again the session is lost =3D> re-login.
And even what I have found for WWW-Mechanize=20
(http://rt.cpan.org/Public/Bug/Display.html?id=3D12882)=20
=A0 =A0 =A0 print $mech->response->request->uri;
=A0shows:=20
# https://acct.server.com/clx/index.php=20
which ist the base not what I need and therefore this:
=A0$mech->get ( $mech->response->request->uri );
only reloads the first login-form and not what I want.
If I do a reload after submitting the form,
=A0 =A0 $mech->reload();
it just reloads the meta=3D"Refresh.. page.
=A0Anybody with an idea how I can get beyond this "meta-page"?=20
=A0Thanks a lot in advance;
=A0Carl=20
Re: Mechanize && meta="Refresh"
am 23.11.2006 19:12:17 von Andy
On Nov 23, 2006, at 3:21 AM, Carl A. Schreiber wrote:
> How do I get beyond the that meta="Refresh" page.
> I konw the answer of Andy Lester in the archive, that
> "The address of the META REFRESH should be available to you in the
> $mech->links() method."
> Yes it is - as you can see below, but how should I use it, all what I
> tried either
Did you do a straight get() on it?
--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance
Re: Mechanize && meta="Refresh"
am 23.11.2006 19:24:23 von gooly
Am Donnerstag, 23. November 2006 19:12 schrieb Andy Lester:
> On Nov 23, 2006, at 3:21 AM, Carl A. Schreiber wrote:
> > How do I get beyond the that meta=3D"Refresh" page.
> > I konw the answer of Andy Lester in the archive, that
> > "The address of the META REFRESH should be available to you in the
> > $mech->links() method."
> > Yes it is - as you can see below, but how should I use it, all what
> > I tried either
>
> Did you do a straight get() on it?
hmm ?? do you mean $mech->get(); or $r->get();
Well, after
=A0 =A0 my $r =3D $mech->submit_form(
=A0 =A0 =A0 =A0 fields =A0 =A0 => {
=A0 =A0 =A0 =A0 =A0 =A0 $uFld =A0 => $uNme,
=A0 =A0 =A0 =A0 =A0 =A0 $pFld =A0 => $pPwd
=A0 =A0 =A0 =A0 }
=A0 =A0 );
I did:
$mech->get();
That gives me again the login page :(
But if I did instead
$r->get();
I get:
Can't locate object method "get" via package "HTTP::Headers" at (eval=20
14) line 1.
Still not where I want to be.
Carl
Re: Mechanize && meta="Refresh"
am 24.11.2006 10:16:45 von gooly
Am Donnerstag, 23. November 2006 19:24 schrieb Carl A. Schreiber:
> Am Donnerstag, 23. November 2006 19:12 schrieb Andy Lester:
> > On Nov 23, 2006, at 3:21 AM, Carl A. Schreiber wrote:
> > > How do I get beyond the that meta="Refresh" page.
> > > I konw the answer of Andy Lester in the archive, that
> > > "The address of the META REFRESH should be available to you in
> > > the $mech->links() method."
> > > Yes it is - as you can see below, but how should I use it, all
> > > what I tried either
> >
> > Did you do a straight get() on it?
>
I just have tried another login - same problem!!
after:
$r = $m->submit_form(
fields => {
$XuFld => $XuNme,
$XpFld => $XpPwd
}
);
die "Couldn't submit form" unless $r->is_success;
I get:
Connecting..
content="0;url=sel?S=Ro9Lze7S&lang=en_US">
and if I follow your recommandation 'straight get()', I get:
content="text/html;charset=iso-8859-1">
Access Denied
It seems to be a bug?
Carl
Re: Mechanize && meta="Refresh"
am 24.11.2006 16:04:42 von gedanken
--0-875775369-1164380682=:86161
Content-Type: TEXT/PLAIN; charset=iso-8859-1
Content-Transfer-Encoding: 8BIT
On Thu, 23 Nov 2006, Carl A. Schreiber wrote:
I think i can help, but i only have this msg and Andy's (aka Big Poppa)
messages, so i really need to ask your forgiveness to forward me the
originial code please.
Andy can vouch for me - Im the guy who asks obvious, moronic questions to
this list but realizes the solution the instant he hits send - Im 100
percent accurrate!!
mfp.
Am Donnerstag, 23. November 2006 19:12 schrieb Andy Lester:
> On Nov 23, 2006, at 3:21 AM, Carl A. Schreiber wrote:
> > How do I get beyond the that meta="Refresh" page.
> > I konw the answer of Andy Lester in the archive, that
> > "The address of the META REFRESH should be available to you in the
> > $mech->links() method."
> > Yes it is - as you can see below, but how should I use it, all what
> > I tried either
>
> Did you do a straight get() on it?
hmm ?? do you mean $mech->get(); or $r->get();
Well, after
my $r = $mech->submit_form(
fields => {
$uFld => $uNme,
$pFld => $pPwd
}
);
I did:
$mech->get();
That gives me again the login page :(
But if I did instead
$r->get();
I get:
Can't locate object method "get" via package "HTTP::Headers" at (eval
14) line 1.
Still not where I want to be.
Carl
--
gedanken
--0-875775369-1164380682=:86161--
Re: Mechanize && meta="Refresh"
am 24.11.2006 16:23:57 von gooly
Am Freitag, 24. November 2006 16:04 schrieb Gedanken:
> On Thu, 23 Nov 2006, Carl A. Schreiber wrote:
>
> I think i can help, but i only have this msg and Andy's (aka Big
> Poppa) messages, so i really need to ask your forgiveness to forward
> me the originial code please.
:) Do you speak Deutsch?
Well my code is just the standard code:
  use WWW::Mechanize;
  my $mech =3D WWW::Mechanize->new( agent =3D> 'Linux Konqueror=
' );
  $mech->get( $url );
  $mech->success or die "Can't get this url $url\n\n";
  # ok, I got the login page..
  my $r =3D $mech->submit_form(
    fields    =3D> {
      $usrFld   =3D> $usrNme,
      $pwdFld   =3D> $pwdPwd
    }
  );
  die "Couldn't submit form" unless $r->is_success;
# ok, now I am logged in and have gotb that meta-page..
print $r content; # shows that meta=3D"refresh"-page, and
$m->links();=20
has all what I think I need for the refresh..
To test you can just open an account at voipBuster.com and try to the=20
login with this piece of code.
To obey what you don't need for testing just use this direct login-site:
https://myaccount.voipbuster.com/clx/index.php?part=3Dplogin &username=3Dpne=
y-fpuervore&password=3Dxwq
Do you need more?
There is not much more,
Calli
>
> Andy can vouch for me - Im the guy who asks obvious, moronic
> questions to this list but realizes the solution the instant he hits
> send - Im 100 percent accurrate!!
>
> mfp.
>
> Am Donnerstag, 23. November 2006 19:12 schrieb Andy Lester:
> > On Nov 23, 2006, at 3:21 AM, Carl A. Schreiber wrote:
> > > How do I get beyond the that meta=3D"Refresh" page.
> > > I konw the answer of Andy Lester in the archive, that
> > > "The address of the META REFRESH should be available to you in
> > > the $mech->links() method."
> > > Yes it is - as you can see below, but how should I use it, all
> > > what I tried either
> >
> > Did you do a straight get() on it?
>
> hmm ?? do you mean $mech->get(); or $r->get();
> Well, after
> Â Â my $r =3D $mech->submit_form(
>     fields    =3D> {
>       $uFld   =3D> $uNme,
>       $pFld   =3D> $pPwd
> Â Â Â Â }
> Â Â );
> I did:
> $mech->get();
> That gives me again the login page :(
>
> But if I did instead
> $r->get();
> I get:
> Can't locate object method "get" via package "HTTP::Headers" at
> (eval 14) line 1.
>
> Still not where I want to be.
> Carl