1. Go to this page and download the library: Download j0k3r/php-imgur-api-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
j0k3r / php-imgur-api-client example snippets
// This file is generated by Composer
nt->setOption('client_id', '[your app client id]');
$client->setOption('client_secret', '[your app client secret]');
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
if ($client->checkAccessTokenExpired()) {
$client->refreshToken();
}
} elseif (isset($_GET['code'])) {
$client->requestAccessToken($_GET['code']);
$_SESSION['token'] = $client->getAccessToken();
} else {
echo '<a href="'.$client->getAuthenticationUrl().'">Click to authorize</a>';
}
// for "Account Base" in account
$client->api('account')->base();
// for "Account Gallery Profile" in account
$client->api('account')->accountGalleryProfile();
// for "Filtered Out Gallery" in Custom Gallery
$client->api('customGallery')->filtered();
// for "Random Gallery Images" in gallery
$client->api('gallery')->randomGalleryImages();
// etc ...