#### #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $url='http://192.168.0.1/WanService.html'; my $lo_url='http://192.168.0.1/logout.html'; my $mech = WWW::Mechanize->new( utocheck => 1 ); $mech->credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' ); # And then $mech->get() the same as in the LWP::UserAgent code my $response = $mech->get($url); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "SUCCESS data type: ", $response->content_type, "\n\n"; #print "\n\n"; #print $response->content; $mech->tick('EnBt3', 'checkbox', 'CHECKED'); #$mech->current_form->POST( submit => { name => "Apply ", value =>"submit" } ); #$mech->click_button(number => 2); #$mech->submit(); #$mech->submit(); $mech->success or die "post failed: ", $mech->response->status_line; my $lo_response = $mech->get($lo_url); die "Error at $lo_url\n ", $lo_response->status_line, "\n Aborting" unless $lo_response->is_success; print "\n\nDone.\n\n";