Hi PodMaster,
Thanks for the swift kick in the butt. :-) I have added strict, warning and diagnostics. I have cleaned up the really stupid mistakes that I had. I can now see it using the cookies unlike before. I was able to successfully fill in the form and retrieve the content i.e my submit_form() method returns a sucess. The content is as follows.
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=https://secure2.playboy.com/
+security/cookieGenerator.do">
<html>
<body bgcolor="#000000" >
</body>
</html>
This is the content I get when I use a regular browser also. So I think the code works until this point. In the regular browser it then goes to the next page which is also a https page. The link for the page is in the variable $member_gateway. I tried downloading that next but when I try that I get the same login page again.
I did read your README. I use linux. so I wont be able to use your repository.
Thank you for your original comments
Here is my new code
#!/usr/bin/perl
use HTTP::Cookies;
use WWW::Mechanize;
use strict;
use warnings;
use diagnostics;
use LWP::Debug qw(+); #Shows the transaction taking place
my $start_page = 'https://secure2.playboy.com/security/loginStart.do?s
+c_target=cyber.playboy.com';
my $mech = WWW::Mechanize->new( agent=>"Mozilla/5.0 (X11; U; Linux i68
+6; en-US; rv:1.7) Gecko/20040918 Firefox/0.9.3 " );
my $cookie_jar = HTTP::Cookies->new(file => './lwp_cookies.dat', autos
+ave => 1,); #Creating a cookie jar
$mech->cookie_jar($cookie_jar); #Attaching cookie jar to the user agen
+t i.e $mech
$mech->get( $start_page );
if ($mech->success()==1) {
print "Success \n";
}
$mech->submit_form(
form_name => 'loginForm',
fields => {
username => 'xxxx',
password => 'xxxx',
savedPWAction => 'on',
}
);
if ($mech->success()==1) {
print "Success \n";
}
print $mech->content();
my $member_gateway='https://secure2.playboy.com/gateway/gateway.do ';
$mech->get($member_gateway);
print $mech->content();
Do you have any suggestions for downloading the next page ?
|