I woke up this morning and it was obvious what to do. :-) As it turned out, I only needed HTTP::Request
Once that has been done, I can use a simple get to turn it on and off.#!/usr/bin/perl use warnings; use strict; use HTTP::Request::Common qw(GET POST); use LWP::UserAgent; my $ua = new LWP::UserAgent(timeout=> 5); #now actually post the form my $request = POST "http://192.168.0.1/login.cgi", [ username => 'myuser@sbcglobal.net', password => 'goombah', ]; my $response = $ua->request($request); my $content = $response->as_string(); #print "$content\n"; #sometimes it asks for the access code, sometimes not if ($content =~ /Access Code Required/){ print "Access Code Required\n"; my $request = POST "http://192.168.0.1/accessLogin.cgi", [ pw0 => 4589235692, #from bottom of modem ]; $response = $ua->request($request); $content = $response->as_string(); print $content; }else {print "sucess\n"}
#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; my $ua = new LWP::UserAgent; my $request = new HTTP::Request( "GET", "http://192.168.0.1/connect.cg +i?conn=0" ); #conn=1 to connect my $response = $ua->simple_request( $request ); my $contents = $response->content(); print "$contents\n";
In reply to Re: Accessing a DSL modem with LWP
by zentara
in thread Accessing a DSL modem with LWP
by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |