PHP/Utility Function/exec
Executing External Applications Using exec()
<source lang="html4strict">
<?php
exec("ls /foo/", $output, $return_val); echo "Exit code of: $return_val\n";
?>
</source>
string exec ( string command [, array &output [, int &return_val]] ) runs an external program
<source lang="html4strict">
print exec("uptime");
</source>
Using exec() to Produce a Directory Listing
<source lang="html4strict">
<html> <head> <title>Using exec() to Produce a Directory Listing</title> </head> <body>
<?php exec( "ls -al .", $output, $return );
print "Returned: $return
";foreach ( $output as $file ) {
print "$file
";
} ?>
</body> </html>
</source>