I get reference from Manual PHP And Telnet To sisco to get value from my mikrotik. below is from Manual PHP, and if code from Telnet To sisco the value is same like this, but difference code.
<?php
set_time_limit(0);
$host = '10.23.45.1';
$port = '23';
$user = 'edp';
$pass = '123';
$socket = fsockopen($host, $port) or die('Could not connect to: '.$host);
$userdota = "palma";
if($socket)
{
sendcmd($user." \r\n",$socket);
sendcmd($pass." \r\n",$socket);
sendcmd("tool bandwidth-test 10.23.35.41 protocol=tcp direction=both user=adminstrator pass=intel \r\n",$socket);
$line=fgets($socket);
echo $line;
}
function sendcmd($cmd,$socket) // send command function
{
fputs($socket, $cmd, strlen($cmd));
}
?>
I want to get value like i using with command prompt like this
status: running duration: 6s tx-current: 509.6kbps tx-10-second-average: 277.9kbps tx-total-average: 277.9kbps rx-current: 971.2kbps rx-10-second-average: 566.7kbps rx-total-average: 566.7kbps random-data: no direction: both
But when i run the code, the value $line
is
ÿýÿý ÿý#ÿý
Not like what i want, Can you give me solution?