Hi
I am a newbie wrt javascript/perl.
I am trying to use perl to login to the playboy website :-)
where I have a *legal* paid subscription.
It uses a javascript based login and I am using WWW::Mechanize
The code I am using is as follows
***********************************
use LWP::UserAgent;
use HTTP::Cookies;
use WWW::Mechanize;
my $start_page = 'https://secure2.playboy.com/security/loginStart.do?s
+c_target=cyber.playboy.com';
my $mech = WWW::Mechanize->new();
my $mech = WWW::Mechanize->new( cookie_jar => "lwpcookies.txt");
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 " );
$mech->get( $start_page );
if ($mech->success()==1) {
print "Success \n";
}
$mech->submit_form(
form_name => 'loginForm',
fields => {
username => 'xxxx',
password => 'xxxx',
savedPWAction => 'on',
submitButton => 'ENTER THE CLUB'
}
);
#$mech->click_button(name => 'submitButton');
#$button='submitButton';
$mech->click;
$result = $mech->success();
if ($result == 1){
print "Success";
}
else {
print "Fail";
}
When I do use this script I get a success for the first part but I cant seem to post the username and passwrd. I get the following error msg.
Can't call method "click" on an undefined value at /usr/lib/perl5/site_perl/5.8.4/WWW/Mechanize.pm line 683.loading the page but I get an error
Can someone please help.
Thank you
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.