0
我是google api和stackoverflow的新手,請耐心等待。 因此,我已經設置了一個完整的設置,以便從Google日曆,授權,密鑰和所有事件中獲取事件。但是,無論如何,我都無法回到任何事件。我已經嘗試了所有不同的日曆,但沒有一個給出任何不同的日曆。我還發現這個方便的小工具與我的服務帳戶相關聯,它顯示了我實際到達服務器時的情況,它總是這樣做,並且它們中的哪一個會導致錯誤。所以,似乎eeeeverything很好,但仍然沒有事件到達。有什麼明顯的我在這裏失蹤? 我試圖製作新的日曆,新活動,新帳戶,並完全重做所有內容。我也得到了更有經驗的人的幫助,但無濟於事。Google API日曆問題PHP
儘管去做:
- 創建一個谷歌的服務帳戶
- 在上述賬戶
- 創建憑據說項目
- 下載JSON創建項目:s的鑰匙和ID:■從賬戶和項目
- 將代碼正確鏈接到代碼中
- 在我的主日曆中創建不同種類的新事件NDAR
- Bugfixing
- 莊家對事件的請求
- Bugfixing直到沒有401只或404出現在日誌中,在谷歌
- 仍然一無所獲
- 試圖同時一些tutorialpage測試它在谷歌
- 廠完美
- ???
下面這對谷歌圖書館的外面一切碼(也正確安裝) DIR_ROOT是我們自制的DIR這需要我們正確的文件夾
<?php
\t \t \t require_once DIR_ROOT . '/vendor/autoload.php';
\t \t \t define('SCOPES', implode(' ', array(
\t \t \t Google_Service_Calendar::CALENDAR)
\t \t \t));
\t \t \t putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/html/Tv-Projektet-222309a0ac14.json');
\t \t \t $client = new Google_Client();
\t \t \t $client->useApplicationDefaultCredentials();
\t \t \t $client->setScopes(SCOPES);
\t \t \t $service = new Google_Service_Calendar($client);
\t \t \t // Print the next 10 events on the user's calendar.
\t \t \t $calendarId = 'primary';
\t \t \t
\t \t \t $optParams = array(
\t \t \t 'maxResults' => 10,
\t \t \t 'orderBy' => 'startTime',
\t \t \t 'singleEvents' => true,
\t \t \t 'timeMin' => date('c'),
\t \t \t);
\t \t \t $results = $service->events->listEvents($calendarId, $optParams);
\t \t \t if (count($results->getItems()) == 0) {
\t \t \t print "No Hermes set for this day. Please update the calendar.\n";
\t \t \t } else {
\t \t \t print "Upcoming events:\n";
\t \t \t foreach ($results->getIgtems() as $event) {
\t \t \t \t $start = $event->start->dateTime;
\t \t \t \t if (empty($start)) {
\t \t \t \t $start = $event->start->date;
\t \t \t \t }
\t \t \t \t printf("%s (%s)\n", $event->getSummary(), $start);
\t \t \t }
\t \t \t }
\t \t \t ?>