in reply to Getting data from an ASPX generated web page
Here is some code that goes toward your stated goal. I leave it to you to read and abide by the site TOS
use strict; use warnings; use WWW::Mechanize; use HTTP::Cookies; my $url = 'http://target-site.com'; my $cookies = HTTP::Cookies->new( file => "cookies.dat" ); my $mech = WWW::Mechanize->new( cookie_jar => $cookies ); $mech->get($url); my ($button) = $mech->find_all_inputs( type => 'image', name_regex => qr/yesButton$/, ); if (defined $button) { print "clicking button...\n"; $mech->click($button->{name}); $cookies->save; } my $response = $mech->content();
The first time it runs, you'll see 'clicking button...'. On subsequent invocations, this step should be avoided because the cookie will be reused
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting data from an ASPX generated web page
by billycote (Novice) on Jul 19, 2013 at 20:05 UTC |