Using popen() and pclose() : popen « File Directory « PHP






Using popen() and pclose()

 
<?php
     $command = "/usr/bin/dialog --inputbox 'What is your Name' 0 0 2>/tmp/php_temp";
     $pr = popen($command, 'w');
     $exit_code = pclose($pr);
         switch($exit_code) {
          case 0:
               $input = implode("", file("/tmp/php_temp"));
               echo "\nYou typed: $input\n";
               break;
          case 1:
               echo "\nWhy did you cancel?\n";
               break;
     }
?>
  
  








Related examples in the same category

1.Using popen() to Pass Data to the column Application
2.Using popen() to Read the Output of the Unix who Command
3.Using popen() with nsupdate
4.Reading output from popen()
5.Opening a Process File Pointer with popen()
6.Opening a Unidirectional Pipe Using popen()
7.Redirecting standard output
8.Reading standard error