質問編集履歴
1
プログラムの全体を追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,55 @@
|
|
32
32
|
|
33
33
|
```php
|
34
34
|
|
35
|
+
|
36
|
+
|
37
|
+
<?php
|
38
|
+
|
39
|
+
date_default_timezone_set('Asia/Tokyo');
|
40
|
+
|
41
|
+
require_once __DIR__.'/google-api-php-client/vendor/autoload.php' ;
|
42
|
+
|
43
|
+
$json_path = __DIR__.'/google-api-php-client/key/*****.json';
|
44
|
+
|
45
|
+
$calendarId='******';
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
//接続用のクライアントの設定.
|
50
|
+
|
51
|
+
$scopes = "https://www.googleapis.com/auth/calendar.events";
|
52
|
+
|
53
|
+
$client = new Google_Client();
|
54
|
+
|
55
|
+
$client->setApplicationName("********");
|
56
|
+
|
57
|
+
$client->setAuthConfig($json_path);
|
58
|
+
|
59
|
+
$client->setScopes($scopes);
|
60
|
+
|
61
|
+
if ($client->isAccessTokenExpired()) {
|
62
|
+
|
63
|
+
$client->refreshTokenWithAssertion();
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
$service = new Google_Service_Calendar($client);
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
//イベント取得
|
72
|
+
|
73
|
+
$eventId = 20180129;
|
74
|
+
|
35
|
-
$result = $service->events->get($calendarId, "
|
75
|
+
$result = $service->events->get($calendarId, "eid");
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
?>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
36
84
|
|
37
85
|
```
|
38
86
|
|