Skip to content

Instantly share code, notes, and snippets.

@jfinstrom
Created September 10, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfinstrom/6e8c4373e4b7d0639fa149401457bc19 to your computer and use it in GitHub Desktop.
Save jfinstrom/6e8c4373e4b7d0639fa149401457bc19 to your computer and use it in GitHub Desktop.
Getting pgp keys and making thenm json
<?php
$results = file_get_contents('http://gpg.mozilla.org/pks/lookup?search=jfinstrom&op=index');
$dom = new DOMDocument;
$dom->loadHTML($results);
$keys = [];
foreach($dom->getElementsByTagName('a') as $link) {
$key = substr($link->getAttribute('href'), -18);
$value = $link->textContent;
$keys[$key] = $value;
}
echo json_encode($keys);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment