<?php

class ZayacController {
    protected static 
$client_id 'E60T8WY3PHSYG0S60T8SPTU-E57Y-76-57-WRUGHOTER7870E567-5UIPUYPOR6T80R77PO';

    public function 
yandexAction() {
        
$scope 'operation-history account-info';
        
ZenYandexClient::setClientId(self::$client_id);
        
ZenYandexClient::authorize($scope'http://' $_SERVER['SERVER_NAME'] . '/zayac/callback/');
    }

    public function 
callbackAction() {
        
ZenYandexClient::setClientId(self::$client_id);
        
$access_token ZenYandexClient::convertAuthToken();
        
$zayac = new ZenYandexClient($access_token);
        
$account $zayac->getAccountInformation();

        
$operations = array();
        while (
false !== ($operation $zayac->next())) {
            
$operations[] = $operation;
        }

        
var_dump($operations);
    }
}

?>