Jump to content

configure 3com router using web based application

- - - - -

  • Please log in to reply
2 replies to this topic

#1
cik_nyamuk

cik_nyamuk

    Newbie

  • Members
  • Pip
  • 3 posts
hye...im new in PHP..and i have my project to configure the 3com router 5009 by using telnet in PHP script
as i review and surf internet, to use telnet, we need to used fsockopen function to connect the telnet..
plzz.help me..where can i get a guideline or something that can be usefull for my project for router configuration using telnet....plzz.

#2
RHochstenbach

RHochstenbach

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
To use Telnet, you need to use Port Forwarding on your Router to forward external TCP port 23 to internal TCP port 23. There you need to set the IP address of the computer you are going to use for this. The location of the settings are different for each brand of router.

#3
cik_nyamuk

cik_nyamuk

    Newbie

  • Members
  • Pip
  • 3 posts
i'm already tried one scripts to make telnet connection using fsockopen but i found error on line "echo ". ".fgets($usenet, 128)."\n";".....the warning error is

<br />
<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>C:\xampp\htdocs\3com_test\main.php</b> on line <b>237</b><br />.....plz explain to me...

<?php  


//$value1=$_POST['text']; 

$ip=$_POST['ip']; 

$port=$_POST['port']; 


$cfgServer = $ip;  //IP of your router 

$cfgPort    = $port;                //port, 22 if SSH 

$cfgTimeOut = 10; 


$usenet = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); 

?> 

<textarea name="ios" cols="50" rows="10" id="ios"> 

<?php 

if(!$usenet) 

        { 

        echo "Connection failed\n"; 

        exit(); 

        } 

else 

        { 

        echo "Connected\n"; 

        fputs ($usenet, "toto\r\n"); 

       fputs ($usenet, "en\r\n"); 

       fputs ($usenet, "tutu\r\n"); 

       fputs ($usenet, "exit\r\n"); 

        while (!feof($usenet)) 

                { 

                echo ". ".fgets($usenet, 128)."\n"; 

                } 

        } 

?> 

   </textarea>

Edited by Roger, 26 July 2011 - 05:23 PM.
added [CODE][/CODE] tags





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users