I've been trying to format the output of SSH2->read() method. I tried using ANSI.php following http://phpseclib.sourceforge.net/ssh/examples.html#top
My code
<?php
include('Net/SSH2.php');
include('File/ANSI.php');
$ssh = new Net_SSH2('10.106.240.212');
$ssh->login('Administrator', 'Nbv12345') or die("Login failed");
$ansi = new File_ANSI();
$ssh->enablePTY();
$ssh->exec("powershell.exe
");
$ssh->setTimeout(2);
echo $ssh->read();
$ssh->write("ls
");
echo $ssh->read();
?>
The output is full of ANSI characters and no 'ls' results
(B)0[?7l[H[J[1;1HWindows PowerShell[2;1HCopyright (C) 2013 Microsoft Corporation. All rights reserved.[4;1HPS C:\Users\Administrator> (B)0[?7l[H[J[1;1H [2;1H [3;1H [4;1H [5;1H [6;1H [7;1H [8;1H [9;1H [10;1H [11;1H [12;1H [13;1H [14;1H [15;1H [16;1H [17;1H [18;1H [19;1H [20;1H [21;1H [22;1H [23;1H [24;1H [1;1HMicrosoft Windows [Version 6.3.9600][2;1H(c) 2013 Microsoft Corporation. All rights reserved.[4;1HC:\Users\Administrator>ls[5;1H
I need something like this, Its not even close:
How can I format this ?