示例#1
0
/* Authorization
/*-----------------------------------------------------------------------------------*/
//We create a new instance of imgur class.
// Imgur oAuth will return code as GET parameter after the user allows access
if (isset($_GET['code'])) {
    $tokens = $imgur->authorize(false, $_GET['code']);
    //First parameter is for refresh_tokens
    //The user is authorized. You can save the $tokens['refresh_token'] and $tokens['access_token'] for future use;
} else {
    // GET parameter doesn't exist, so we will have to ask user to allow access for our application
    $imgur->authorize();
}
/*-----------------------------------------------------------------------------------*/
/* Account
/*-----------------------------------------------------------------------------------*/
$imgur->account("username")->basic();
$imgur->account("username")->albums($page = 0);
$imgur->account("username")->images($page = 0);
$imgur->account("new_username")->create($options);
//$options will be used as post fields. For more info go to Imgur API Docs.
//....
/*-----------------------------------------------------------------------------------*/
/* Images
/*-----------------------------------------------------------------------------------*/
$imgur->image("image_id")->get();
$imgur->image("image_id")->delete();
$imgur->image('image_id')->update($options);
$imgur->image("image_id")->favorite();
//....
/*-----------------------------------------------------------------------------------*/
/* Comments