Last active
April 28, 2023 08:36
-
-
Save mattiasghodsian/8fe51b59e4fe0313236028fdfa5811b1 to your computer and use it in GitHub Desktop.
[PHP] List any users public gists
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
/** | |
* Title: Get gists | |
* Author: Mattias Ghodsian | |
* Description: List any users public gists | |
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian | |
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5 | |
*/ | |
$profile_url = "https://api.github.com/users/mattiasghodsian/gists"; | |
$options = array('http' => array('user_agent'=> $_SERVER['HTTP_USER_AGENT'])); | |
$context = stream_context_create($options); | |
$data = file_get_contents($profile_url, false, $context); | |
$gists = json_decode( $data , true); | |
echo '<ol>'; | |
foreach ($gists as $key => $gist) { | |
echo '<li>['.$gist['updated_at'].'] <a href="'.$gist['url'].'">'.$gist['description'].'</a></li>'; | |
} | |
echo '</ol>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment