phpisnotfordummies Posted March 2, 2007 Share Posted March 2, 2007 Hello! I'm trying to get my PHP form processor to encrypt the data using GnuPG. $gpg = 'usr/bin/gpg'; $recipient = '[email protected]'; $encrypted_message = base64_encode(shell_exec("echo $message | $gpg -e -r $recipient")); What I get in return is "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING" for the first or second line. I wonder why? Could it be that the path to the binary is wrong? I have tried using double quotes and changing the variables names. Could you help please? Thanks Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/ Share on other sites More sharing options...
monk.e.boy Posted March 2, 2007 Share Posted March 2, 2007 $gpg = 'usr/bin/gpg'; $recipient = '[email protected]'; $tmp = "echo $message | $gpg -e -r $recipient"; echo $tmp; $tmp2 = shell_exec($tmp); echo $tmp2; $encrypted_message = base64_encode($tmp2); try this. Also try cutting and pasting whatever $tmp is echo'd as onto the command line to see if it works. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/#findComment-197757 Share on other sites More sharing options...
phpisnotfordummies Posted March 2, 2007 Author Share Posted March 2, 2007 Thanks for the reply. Now it is just printing "echo the message | usr/bin/gpg -e -r [email protected]" on my confirmation page and the e-mail I get is blank. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/#findComment-197775 Share on other sites More sharing options...
monk.e.boy Posted March 2, 2007 Share Posted March 2, 2007 So $tmp2 is blank? That means $tmp, that you are passing to shell_exec is broken. Did you try running what $tmp is echoing? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/#findComment-197830 Share on other sites More sharing options...
phpisnotfordummies Posted March 2, 2007 Author Share Posted March 2, 2007 What seems to be the problem with my original script? I'm new to PHP so I basically copied it from a "respectable" source... Isn't it just about the syntax? Thanks Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/#findComment-197879 Share on other sites More sharing options...
monk.e.boy Posted March 2, 2007 Share Posted March 2, 2007 What seems to be the problem with my original script? I'm new to PHP so I basically copied it from a "respectable" source... Isn't it just about the syntax? Thanks Duh. What did you think I was asking the questions for? I was trying to help you find the bug in your original script. I guess I could brush you off with a 'learn to program' answer monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/#findComment-197931 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.