[PHP3] PHP/PGP Desperation? From: News (news <email protected>)
Date: 09/30/98

Hi Folks,

Sorry to bog down this list with territory, but I have still not been able
to achieve what should be very simple with PHP. I simply need to encrypt a
16 digit number with PGP and get the returned encrypted ascii text into a
variable.

I have access to both PHP2 and PHP3 and can't get the respective codes to
work on either. However when I run on PHP2 the script does produce the
following output "256". Just the number 256 -- no encrypted text or
anything. I have also tried subsituting the 'passthru()' and 'system()'
commands for the exec command, but to no avail. I have the two PHP docs
(both the web form and the script it executes) set to chmod 777 and owned
by a user that can execute the same command successfully from command line
from the same directory etc.

In the following PHP2 code note the 'echo "test here";' statement. When I
run the script with exec() command I don't get the "test here" text
(signifying that the array is empty?) and the '$output' variable is
returned empty, but when I substitute the passthru() or system() command I
do get the "test here" text and the $output variable is echoed as "256".

Anybody have any ideas what this could signify and how I solve this puzzle.
Alternately, if I can't get this to work with PHP does anybody know of any
Perl scripts that could get the job done?

------------------------

<? $cmd = "echo $cardnumber|pgp -efa orders <email protected>";
unset($output);
exec($cmd,$output);
$data_encrypted = "";
$i = 0;
while ($i < count($output));
echo "test while ";
if ((!ereg("-----|^Version: 2\.6\.2",$output[$i])) &&
(!ereg(10,$output[$i])));
$data_encrypted = $data_encrypted + $output[$i] + "\n";
endif;
$i++;
endwhile;
echo "RESULTS, $output, $data_encrypted";
>

------------------

THANKS,
BEN

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3