-
-
Save nickstewart95/92452d9c0e47c702250d13d6f8a682bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scopes = array('https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly'); | |
$credentials = new Google_Auth_AssertionCredentials( | |
$client_email, | |
$scopes, | |
$private_key, | |
'notasecret' | |
); | |
$client = new Google_Client(); | |
$client->setAssertionCredentials($credentials); | |
if ($client->getAuth()->isAccessTokenExpired()) { | |
$client->getAuth()->refreshTokenWithAssertion(); | |
} | |
//only get events for today | |
$today = date('H:i'); | |
$current_time = strtotime($today); | |
$params = array( | |
'singleEvents' => false, | |
'timeMin' => (new DateTime())->format(DateTime::RFC3339), | |
'timeMax' => (new DateTime())->add(new DateInterval('P1D'))->format(DateTime::RFC3339) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment