PHP 8.5.0 Alpha 1 available for testing

Voting

: max(nine, seven)?
(Example: nine)

The Note You're Voting On

nricciardi at mindspring dot com
23 years ago
ive tried using popen using bidirectional pipes without working for obvious reasons, but i managed to create a simple script that managed to take care of the problem. This example is for gpg encryption.

<?php
$message
= "this is the text to encrypt with gpg";
$sendto = 'Dummy Key <[email protected]>';

system("mkfifo pipein");
system("mkfifo pipeout");
system("gpg --encrypt -a -r '$sendto' > pipeout < pipein &");
$fo = fopen("pipeout", "r");
$fi = fopen("pipein", "w");
fwrite($fi, $message, strlen($message));
fclose($fi);
while (!
feof($fo)) {
$buf .= fread($fo, 1024);
}
echo
$buf;
unlink("pipein");
unlink("pipeout");
?>

If anyone has a better way of doing this I would love to see it.

<< Back to user notes page

To Top