perl - How to use WWW:Mechanize to login -
perl - How to use WWW:Mechanize to login -
i want login western farsi blogging service . code:
#!/usr/bin/perl utilize www::mechanize; $mech = www::mechanize->new(); $url = "http://blogfa.com/desktop/login.aspx?t=1"; $mech->get($url); $result = $mech->submit_form( form_name => 'aspnetform', #name of form #instead of form name can specify #form_number => 1 fields => { 'master$contentplaceholder1$uid' => 'my username', # name of input field , value 'master$contentplaceholder1$password' => 'my password', } ,'master$contentplaceholder1$btnsubmit' => 'ورود به بخش مدیریت' #name of submit button ); $result->content(); if ($result =~ /میز کار/) { print "done\n"; } else { print "failed!\n"; }
but doesn't work @ all. problem?
the problem is, www:mechanize
not execute javascript. since site want log in uses javascript logging in, not able that.
you prepare problem using www::mechanize::firefox
, allows execute javascript.
perl
Comments
Post a Comment