1.2.1508. ext/expect¶
Extension Expect.
This extension allows to interact with processes through PTY
. You may consider using the expect://
wrapper with the filesystem functions which provide a simpler and more intuitive interface.
<?php
ini_set('expect.loguser', 'Off');
$stream = fopen('expect://ssh root@remotehost uptime', 'r');
$cases = array (
array (0 => 'password:', 1 => PASSWORD)
);
switch (expect_expectl ($stream, $cases)) {
case PASSWORD:
fwrite ($stream, 'password'.PHP_EOL);
break;
default:
die ('Error was occurred while connecting to the remote host!'.PHP_EOL);
}
while ($line = fgets($stream)) {
print $line;
}
fclose ($stream);
?>
See also expect.
1.2.1508.1. Specs¶
Short name |
Extensions/Extexpect |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |