michael Sun Oct 2 04:22:21 2005 EDT
Modified files: /phpdoc/en/reference/expect reference.xml Log: use constant as more intuitive example http://cvs.php.net/diff.php/phpdoc/en/reference/expect/reference.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/expect/reference.xml diff -u phpdoc/en/reference/expect/reference.xml:1.1 phpdoc/en/reference/expect/reference.xml:1.2 --- phpdoc/en/reference/expect/reference.xml:1.1 Sun Oct 2 03:31:52 2005 +++ phpdoc/en/reference/expect/reference.xml Sun Oct 2 04:22:21 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- Purpose: system --> <!-- Membership: pecl --> @@ -49,30 +49,28 @@ <programlisting role="php"> <![CDATA[ <?php - ini_set ("expect.loguser", "Off"); -$fp = expect_popen ("ssh [EMAIL PROTECTED] uptime"); +$stream = popen ("expect://ssh [EMAIL PROTECTED] uptime", "r"); $cases = array ( - array (0 => "password:", 1 => "PASSWORD") + array (0 => "password:", 1 => PASSWORD) ); -switch (expect_expectl ($fp, $cases)) +switch (expect_expectl ($stream, $cases)) { - case "PASSWORD": - fwrite ($fp, "password\n"); + case PASSWORD: + fwrite ($stream, "password\n"); break; default: die ("Error was occurred while connecting to the remote host!\n"); } -while ($line = fgets ($fp)) { +while ($line = fgets ($stream)) { print $line; } -fclose ($fp); - +fclose ($stream); ?> ]]> </programlisting>