in reply to how to reboot adsl modem with perl?

Can you reboot it from the configuration page (should be http://192.168.1.1)? If so then you can use WWW::Mechanize to get the connection information you are looking for, and to reboot the device.

IMHO WWW::Mechanize is well documented and has some example code to get you started. If you have any other problems let us know.

Cable modem status should give you an idea of how to do this using LWP::Simple.

Update: I googled this device, it would seem that it does have a web interface, and you can reboot ('Restart') it from the 'Tools'->'SystemCommands' menu on the web interface. Consult your user guide for more information.

Hope this helps.

Martin
  • Comment on Re: how to reboot adsl modem with perl?

Replies are listed 'Best First'.
Re^2: how to reboot adsl modem with perl?
by MelaOS (Beadle) on Feb 23, 2007 at 01:44 UTC
    Hi Fletch, Martin, Thanks for providing me somewhere to start. Hope my newbie perl skill will be enough to do the job :)
      No problem MelaOS,

      if you do have any problems post your code, a description of the problem along with the error message, and the kind monks will reply with advice.

      Martin
        Hi Martin, Great, that's because so far i'm kind of stuck :(
        After browsing through some simple tutorial this is what i came up with.

        use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); # connect to the adsl setting page $mech->get( "http://192.168.1.1" ); # connect with user name and password my $r = $mech->submit_form( form_number => 2, fields => 'uiViewUserName' => "admin", 'uiViewPassword' => "admin"); die "Couldn't submit form" unless $r->ls_success; # print the content of the admin page so that i know i'm in #print $mech->content;

        I've try other methods like $mech->field, $mech->set_visible but i always get this error back.
        Error GETing http://192.168.1.1: Can't connect to 192.168.1.1:80 (connect: Unknown error) at C:\Documents and Settings\Mela\Desktop\simple.pl line 4
        and included is the html content for that admin page that i get by using $mech->get( "http://192.168.1.1", ":content_file" => "C:\output.txt" );

        Basically i just want the script to login, check if the status is disconnected or then proceed to reboot the router.
        Any advice on what am i doing wrong here?