Skip to content

Instantly share code, notes, and snippets.

Created November 28, 2012 12:19
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Create hangout link via calendar
* example usage:
* First call to get the url
* php calcreate.php
* After authorising, grab the code from the redirect URL
* php calcreate.php "long_code_value_from_oauth_callback"
* This will var_dump out the new calendar entry
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
$client = new Google_Client();
$client->setApplicationName('Hangout Schedule');
$service = new Google_CalendarService($client);
$token_file = sys_get_temp_dir() . PATH_SEPARATOR . "gcalhang.tok";
if(file_exists($token_file)) {
$token = json_decode(file_get_contents($token_file));
if($client->isAccessTokenExpired()) {
if($_SERVER['argc'] == 1) {
echo $client->createAuthUrl(), "\n";
} else {
$code = $_SERVER['argv'][1];
file_put_contents($token_file, json_encode($client->getAccessToken()));
$event = new Google_Event();
$event->setSummary('Future Hangout');
$event->setLocation('The Internet!');
$start = new Google_EventDateTime();
$end = new Google_EventDateTime();
$attendee1 = new Google_EventAttendee();
$attendees = array($attendee1);
$event->attendees = $attendees;
$createdEvent = $service->events->insert('primary', $event);
Copy link

hi i am getting the SSL error while click on the Accept Button after adding the attendees to the circles

Copy link

aijanai commented Aug 12, 2015

where is the hangout related code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment