1
$key = file_get_contents('http://keyserver.pramberger.at/pks/lookup?op=get&search=userid'); 

this code gives me public key with the html tag .how to extract the public key block form begin pgp public key block ---to---- end pgp public key block and using this public key i need to encrypt the data .i need to do it in php.

1
  • 1
    Your questions are all very similar. Why don't you state your question clearly and also provide code examples what you have done so far. Also creating a second account is not for you advantage I guess. Commented Mar 18, 2010 at 10:17

2 Answers 2

2

try this
preg_match('/PUBLIC KEY BLOCK-----\s(.*?)\s-----END PGP/s', $data, $match);
echo $match[1]; //returns the key

Sign up to request clarification or add additional context in comments.

Comments

0

or that

$pgp_key = trim(preg_replace('/(.*)<pre>(.*)<\/pre>(.*)/s','\2',$key)); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.