Open a pipe to the program specified by the command parameter.
<?php $file = popen(“/bin/ls”,“r”); //some code to be executed pclose($file); ?> |
The popen() function creates a pipe to the program specified by the command parameter.
popen(command, mode) |
Parameter |
Description |
command |
Required. Specifies the command to be executed. |
mode |
Required. Defines the mode of connection, either “r” (read-only) or “w” (write-only, which opens and clears an existing file or creates a new one). |
Return Value: |
Returns FALSE on failure. |
PHP Version: |
4.0+ |