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 ?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.