Last active
June 28, 2016 11:54
-
-
Save cerkauskas/5f165529ad42fbc9a3da876855cb23fd to your computer and use it in GitHub Desktop.
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 | |
require_once 'vendor/autoload.php'; | |
try { | |
// Creating the client, that will connect us to GitHub API | |
$client = new GuzzleHttp\Client([ | |
'base_uri' => 'https://api.github.com' | |
]); | |
// Performing request to get response | |
$response = $client->get('/users/cerkauskas'); | |
// Getting body of response | |
$body = $response->getBody(); | |
// Adding pre tag to make formatting more beautiful and readable | |
echo '<pre>'; | |
echo $body; | |
echo '</pre>'; | |
} | |
catch (Exception $e) { | |
// Damn, why I have so many visitors | |
echo 'Whoops, it seems like we reached the limit'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment