views:

49

answers:

1
$importkey = system('gpg --import newkey.asc . $username');

need to pass the file name as a variable.so that file name with its contents can be import in gnupg keyring.

$gpg = system('gpg --recipient userid  --output filename --armor  --encrypt filename to encrypt', $retvalue);

how can i pass the recipient email id(userid) and the filename as variable to gpg commands

thanks!

+1  A: 

Change the ' to " for example and then you can pass in variables:

$importkey = system("gpg --import newkey.asc . $username");
zaf
Change the ' to " -what you want to suggest please explain
trainee
Use double quotes (") instead of single quotes ('). Look at my example and yours and spot the difference.
zaf
still not working .is there another way to do it
trainee
Construct the command in a string and then supply this to the system command. Give us the value for this string to debug. For example: $cmd=""gpg --import newkey.asc . $username";print($cmd); $importkey=system($cmd);
zaf