Здесь я получаю следующий и предыдущий URL, но при попытке получить доступ к следующей странице с URL, я получаю сообщение об ошибке, какРазбивка в Google Analytics отчет
Error: {"error":{"errors":[{"domain":"global","reason":"required","message":"Login Required","locationType":"header","location":"Authorization"}],"code":401,"message":"Login Required"}}
public function getPaginationInfo(&$results) {
$client = new Google_Client();
if(isset($_SESSION['access_token'])){
$client->setAccessToken($_SESSION['access_token']);
}
// Create an authorized analytics service object.
$analytics = new Google_Service_Analytics($client);
// Get the first view (profile) id for the authorized user.
$profile = $this->getFirstProfileId($analytics);
// Get the results from the Core Reporting API and print the results.
$this->results = $this->getResults($analytics, $profile);
var_dump($this->results);
$html = <<<HTML
<pre>
Items per page = {$this->results->getItemsPerPage()}
Total results = {$this->results->getTotalResults()}
Previous Link = {$this->results->getPreviousLink()}
Next Link = {$this->results->getNextLink()}
</pre>
HTML;
print $html;
}
Я также хочу узнать текущий номер страницы, есть ли какая-нибудь функция для этого?
Возможный дубликат [URL-адрес страницы текущей страницы страницы Google Analytics и следующей проверки подлинности] (http://stackoverflow.com/questions/34089788/google-analytics-api-pagination-current-page-number-and-nextpage-authentication) –