Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for the help :)use strict; use warnings; use WWW::Mechanize; use Data::Dumper; my $mech = WWW::Mechanize->new(); my $url = 'http://myspace.com/Modules/ViewFriends/FriendsView.aspx?%3f +fuseacion=user.viewfriends&friendID=' . 16193600; $mech->get( $url ); #print $mech->content(); # my $links = $mech->find_all_links(); # print Dumper($links); my $next_link = $mech->find_link( text_regex => qr/Next/i ); if($next_link) { my $url = $next_link->url(); if($url =~ /javascript:__doPostBack\('(.*)','(.*)'\)/) { my $target = $1; print "TARGET: $target\n"; my $argument = $2; print "ARGUMENT: $argument\n"; $mech->submit_form( { form_name => 'aspnetForm', fields_ref => { '__EVENTTARGET' => $target, '__EVENTARGUMENT' => $argument, }, } ) } } else { print "no more links on page\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mechanize & doPostBack ?
by gam3 (Curate) on Jan 13, 2007 at 07:20 UTC | |
by ikegami (Patriarch) on Jan 13, 2007 at 21:01 UTC |