I am trying to connect a unix server from php and execute .exe (C language). Earlier I used phptelnet for this purpose, but now I need to shift to phpseclib due to security issues. I had 100% success rate when I use phptelnet. I could run some of the external programs like 'C' programs with arguments as input in php script. In phptelnet I use
$telnet->DoCommand('cd public_html');
$telnet->DoCommand('cd abc');
$telnet->DoCommand('demo.exe');
$telnet->DoCommand("$inputs", $result);
echo $result;
This works perfect. But now I am using phpseclib. I could connect to the unix server via ssh and execute programs in which the inputs are hard coded in the program. I am using
echo $ssh->exec('./demo.exe');
Now the problem is how to provide inputs to the program. How can I use exec() to accept arguments as inputs. For example, demo.exe is a program to add two numbers. so can I say
echo $ssh->exec("./demo.exe, '10 20'");
Also how can I use exec() to execute multiple lnes of code in a single execution. I am a bit confused. Any inputs on this are greatly appreciated.
Thanks in advance.