ERROR in inclusion Google_Service_Calendar_Event

1

I need to use Google Calendar for events, but when I test the error on line 40.

<?php
// Refer to the PHP quickstart on how to setup the environment:
// https://developers.google.com/calendar/quickstart/php
// Change the scope to Google_Service_Calendar::CALENDAR and delete any stored
// credentials.
//require_once('/home/campa094/public_html/vendor/autoload.php');
include_once __DIR__ . '/../vendor/autoload.php';

$event = new Google_Service_Calendar_Event(array(
  'summary' => 'Google TESTE ',
  'location' => 'local teste , AV. DO ADEUS , BR 9000',
  'description' => 'TESTE DA AGENDA .',
  'start' => array(
    'dateTime' => '2018-05-28T09:00:00-07:00',
    'timeZone' => 'America/São Paulo',
  ),
  'end' => array(
    'dateTime' => '2018-05-28T17:00:00-07:00',
    'timeZone' => 'America/São Paulo',
  ),
  'recurrence' => array(
    'RRULE:FREQ=DAILY;COUNT=2'
  ),
  'attendees' => array(
    array('email' => '[email protected]'),
    array('email' => '[email protected]'),
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
));

$calendarId = 'primary';
$event = $service->events->insert($calendarId, $event);
printf('Event created: %s\n', $event->htmlLink);
?>

Error:

Fatal error: Uncaught Error: Call to a member function insert() on null in /home/xxx/public_html/agenda/cria_agenda_google.php:40 Stack trace: #0 {main} thrown in /home/xxx/public_html/agenda/cria_agenda_google.php on line 40
    
asked by anonymous 17.05.2018 / 22:14

0 answers