The popen() function opens a pipe to the program specified in the command parameter.
PHP popen() Function has the following syntax.
popen(command,mode)
Parameter | Is Required | Description |
---|---|---|
command | Required. | Command to execute |
mode | Required. | Connection mode. |
Possible values for the mode:
This function returns FALSE if an error occurs.
Opens a pipe to the program specified in the command parameter
<?php
$file = popen("/bin/ls","r");
//some code to be executed
pclose($file);
?>