Try opeining it in a pipe its the best way to get close to your external binary.
When your wishing to communicate with your binaries a simple system or exec will suffice as long as you are not dependant on information returned by that binary.
But say with something like gpg where you could have a process that goes through several stages then opening a pipe to that binary is your best bet, you could then take action on the returned info.
PHP Code:
<?php
/* Add 2>&1 so we can get stderr. */
$handle = popen('ls adir/ 2>&1', 'r');
echo "'$handle'; " . gettype($handle) . "\n";
while($read = fread($handle, 2096)){
echo $read;
}
pclose($handle);
?>
$output = `ls adir/`; echo "$output<br>";
All this will do is display ls adir/ .
Make sure you have permissions to view the dir or it wont work. test on /tmp
Ibbo
Last edited by ibbo; 08-25-2004 at 04:44 AM..
|