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.
This module uses the functions of the expect library. You need libexpect version >= 5.43.0.
Esta estensão PECL não vem compilada com o PHP. Informações para a instalação desta extensão PECL podem ser encontradas no manual no capitulo entitulado Instalação de extensões PECL. Informações adicionais como novas versões, downloads, arquivos fontes, manutenções, e um Changelog, podem ser obtidos aqui: http://pecl.php.net/package/expect.
No PHP 4, os fontes desta estensão PECL
podem ser encontrados no diretório ext/ ou dentro dos fontes do
PHP ou no link PECL acima.
In order to use these functions you must compile PHP with expect support
by using the --with-expect[=DIR]
configure option.
Windows users will enable php_expect.dll inside of php.ini in order to use these functions. No PHP esta DLL reside no diretório extensions/ junto aos binários do PHP para Windows. Você pode baixar esta extensão PECL DLL a apartir de downloads PHP ou em http://snaps.php.net/.
O comportamento dessas funções podem ser modificado pelas configurações do php.ini.
In order to configure expect extension, there are configuration options in the configuration file php.ini.
Tabela 1. Expect Opções de Configuração
Nome | Padrão | Modificável | Changelog |
---|---|---|---|
expect.timeout | "10" | PHP_INI_ALL | |
expect.loguser | "1" | PHP_INI_ALL | |
expect.logfile | "" | PHP_INI_ALL |
Breve descrição das diretivas de configuração.
expect.timeout
integerThe timeout period for waiting for the data, when using the expect_expectl() function.
A value of "-1" disables a timeout from occurring.
Nota: A value of "0" causes the expect_expectl() function to return immediately.
expect.loguser
booleanWhether expect should send any output from the spawned process to stdout. Since interactive programs typically echo their input, this usually suffices to show both sides of the conversation.
expect.logfile
stringName of the file, where the output from the spawned process will be written. If this file doesn't exist, it will be created.
Nota: If this configuration is not empty, the output is written regardless of the value of expect.loguser.
expect_popen() returns an open PTY stream used by expect_expectl().
As contantes abaixo são definidas por esta extensão e somente estarão disponíveis quando a extensão foi compilada com o PHP ou carregada dinamicamente durante a execução.
Indicates that the pattern is a glob-style string pattern.
Indicates that the pattern is an exact string.
Indicates that the pattern is a regexp-style string pattern.
Value, returned by expect_expectl(), when EOF is reached.
Value, returned by expect_expectl() upon timeout of seconds, specified in value of expect.timeout
Value, returned by expect_expectl() if no pattern have been matched.
This example connects to the remote host via SSH, and prints the remote uptime.