Skip to content

Instantly share code, notes, and snippets.

@cerkauskas
Last active June 28, 2016 11:54
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 cerkauskas/5f165529ad42fbc9a3da876855cb23fd to your computer and use it in GitHub Desktop.
Save cerkauskas/5f165529ad42fbc9a3da876855cb23fd to your computer and use it in GitHub Desktop.
<?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