П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3523 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 6121 раз(а).

Учебник HTML.
Просмотров 3276 раз(а).

Руководство по PHP5.
Просмотров 5497 раз(а).

Хостинг через призму DNS.
Просмотров 4148 раз(а).

Подборка текстов стандартных документов.
Просмотров 55773 раз(а).

Учебник PHP - Самоучитель
Просмотров 3093 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 5741 раз(а).

Внешние атаки...
Просмотров 3841 раз(а).

Учебник PHP.
Просмотров 2825 раз(а).

SSI в примерах.
Просмотров 37463 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

expect_expectl

(no version information, might be only in CVS)

expect_expectl -- Waits until the output from a process matches one of the patterns, a specified time period has passed, or an EOF is seen

Описание

mixed expect_expectl ( resource expect, array cases )

Waits until the output from a process matches one of the patterns, a specified time period has passed, or an EOF is seen.

Список параметров

expect

An Expect stream, previously opened with expect_popen().

cases

An array of expect cases. Each expect case is an indexed array, as described in the following table:

Таблица 1. Expect Case Array

Index KeyValue TypeDescriptionIs MandatoryDefault Value
0stringpattern, that will be matched against the output from the streamyes 
1mixedvalue, that will be returned by this function, if the pattern matchesyes 
2integer pattern type, one of: EXP_GLOB, EXP_EXACT or EXP_REGEXP noEXP_GLOB

Возвращаемые значения

Returns value associated with the pattern that was matched.

On failure this function returns: EXP_EOF, EXP_TIMEOUT or EXP_FULLBUFFER

Примеры

Пример 1. expect_expectl() example

<?php
// Copies file from remote host:
ini_set ("expect.timeout", 30);

$stream = popen ("expect://scp user@remotehost:/var/log/messages /home/user/messages.txt", "r");

$cases = array (
  array (
0 => "password:", 1 => PASSWORD),
  array (
0 => "yes/no)?", 1 => YESNO)
);

while (
true) {
switch (
expect_expectl ($stream, $cases))
{
  case
PASSWORD:
   
fwrite ($stream, "password\n");
   break;

  case
YESNO:
   
fwrite ($stream, "yes\n");
   break;

  case
EXP_TIMEOUT:
  case
EXP_EOF:
   break
2;
  
  default:
   die (
"Error has occurred!\n");
}
}

fclose ($stream);
?>

Смотрите также

expect_popen()



Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru