ochi Posted March 18, 2010 Share Posted March 18, 2010 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 More sharing options...
trq Posted March 18, 2010 Share Posted March 18, 2010 Try using.... ls --color=never Link to comment https://forums.phpfreaks.com/topic/195662-stream-characters/#findComment-1028034 Share on other sites More sharing options...
ochi Posted March 18, 2010 Author Share Posted March 18, 2010 Perfect!!! thank you so much!!! Link to comment https://forums.phpfreaks.com/topic/195662-stream-characters/#findComment-1028038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.