Jump to content

stream characters


ochi

Recommended Posts

hello, I have a program very simple, it conects to other computer with ssh (this computer has ubuntu server as operation system), change the directory and make an ls:

 

$con = ssh2_connect("192.1.1.15", 22) or die ("no hay conexión SSH compruebe puerto y dirección");
    $autent = ssh2_auth_password($con, $usu, $contra) or die ("no hay conexión SSH compruebe usuario y contraseña");
    $shell = ssh2_shell($con,'xterm');

    fwrite($shell,"sudo bash \n ");    
    sleep(1);

    fwrite($shell,$contra."\n ");    
    sleep(1);

    fwrite($shell,"cd /var/streaming/playlists \n ");    
    usleep(990000);    

    fwrite($shell,"ls \n");    
    usleep(990000);
        
    $respuesta = stream_get_contents($shell,-1);
    $pos = strpos($respuesta, "root@user:/var/streaming/playlists#");
    $trozo = substr($respuesta,$pos);

    echo $trozo; 

 

The problem is that what I read is some symbols (and the information):

 

[0m[01;34mvideo[0m [mroot@user:/var/streaming/playlists# 

 

instead of:

 

video root@user:/var/streaming/playlists#

 

Do you know how can I solve it?

 

Thanks! Regards!!!!

Link to comment
https://forums.phpfreaks.com/topic/195662-stream-characters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.