Community discussions

MikroTik App
 
butteryak
newbie
Topic Author
Posts: 40
Joined: Fri Sep 12, 2008 1:16 am

PHP telnet commands

Thu Sep 16, 2010 2:16 am

I'm not sure what I'm doing wrong, perhaps I'm missing somthing simple. but I'm trying to issue a command via a PHP telnet session.
I'm connecting via telnet ok, but for some reason the command is not issued. I will admit, I know very little about the subject, but a push in the right direction could be helpful.

I'm just working with a test command right now to see if I can even do it, but Eventually I want to send a small script that will update a user.

My code:
<?php
require_once "PHPTelnet.php";

$telnet = new PHPTelnet();


$result = $telnet->Connect('192.168.1.1','xxxxx','xxxxx');

if ($result == 0) {
$telnet->DoCommand('some command', $result);

echo $result;


$telnet->Disconnect();
}
?> 
LIke I said, it connects fine, I can see it log in and out via Winbox Logs, but no command is issued.

Thanks folks.