Created
September 10, 2018 18:51
-
-
Save jfinstrom/6e8c4373e4b7d0639fa149401457bc19 to your computer and use it in GitHub Desktop.
Getting pgp keys and making thenm json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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