Пример #1
0
        $access_token = $api->getAccessToken($request_token, $_GET['oauth_verifier']);
        
        /* Put access token into session. It's all we need now */
        $_SESSION['access_token'] = serialize($access_token);
        
        /* Redirect to cointoss game, now with access token */
        header('Location: ' . $APP_CALLBACK_URL);
        die;
    }
}

/* If we reach this point, we have an access token. Yay! we can get information */

/* Get app api as well */
$app_api = new OAuthClient(new EccServiceProvider(), $consumer);
$app_token = $app_api->selfAuthorize($APP_ACCOUNT_ID);
$app_api = new EccClient(new EccServiceProvider(), $consumer, $app_token);

/* Construct api object*/
$user_api = new EccClient(new EccServiceProvider(), $consumer, unserialize($_SESSION['access_token']));

/* Obtain the users balance */
$account = $user_api->summary();

/* Obtain the applications balance */
$app_account = $app_api->summary();

?>
Accessing <?php 
echo $account->account;
?>