phpseclib/phpseclib — pull request #58 by tamagokun (2013-01-17 19:10:19+00:00)
Title: Send request-pty when using exec()

There are some cases where I would like to force SSH to use a tty so that I can in turn interact with the SSH session.

This would come in handy if you want to respond to a prompt programmatically.

(e.g. sending a password, or answering yes/no to a question)

An example:

```php
login('username','password');

$ssh->exec('git clone git@github.com:phpseclib/phpseclib.git', false, true);

$output = '';
$complete = false;
while(!$complete) {
$temp = $ssh->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);
if ($temp === true || $temp === false) {
$complete = true;
} else {
$output .= $temp;
if(preg_match('/\(yes\/no\)/', $temp)) {
$ssh->_send_channel_packet(NET_SSH2_CHANNEL_EXEC, "yes\n");
}
}
echo $output;
```

This would respond "yes" if asked about the authenticity of connecting to github.com