Reputation: 11
$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.
Upvotes: 1
Views: 234
Reputation: 408
or that
$pgp_key = trim(preg_replace('/(.*)<pre>(.*)<\/pre>(.*)/s','\2',$key));
Upvotes: 0
Reputation: 21
try this
preg_match('/PUBLIC KEY BLOCK-----\s(.*?)\s-----END PGP/s', $data, $match);
echo $match[1]; //returns the key
Upvotes: 2