Problem to synchronize with Google Calendar

Hi,

I downloaded from dhtmlx.com/x/download/regular/gCal_proxy_v2.zip and I tried many times to sync with Google Calendar and until now I have not had success.

The code I use is the sample.html and just works on localhost, but when I upload it to my server no longer works… the events are not loaded.

<?php

$email = "myaccount@gmail.com";
$pass = "mypassword";
$cal = "myaccount@gmail.com"; // to load the default calendar

include('google_proxy.php');
$calendar = new GoogleCalendarProxy($email, $pass, $cal);
$calendar->map("location", "details");
//$calendar->enable_log(true);
$calendar->connect();

?>

The following error appears when calling the proxy:

Fatal error: Uncaught exception ‘Exception’ with message ‘Unknown gCal calendar’ in /home/content/h/r/a/test/html/system/dhtmlx/gCal_proxy/server/google_proxy.php:290 Stack trace: #0 /home/content/h/r/a/test/html/system/dhtmlx/gCal_proxy/server/google_proxy.php(260): GoogleCalendarProxy->render() #1 /home/content/h/r/a/test/html/system/dhtmlx/gCal_proxy/server/01_proxy.php(18): GoogleCalendarProxy->connect() #2 {main} thrown in /home/content/h/r/a/test/html/system/dhtmlx/gCal_proxy/server/google_proxy.php on line 290

What am I doing wrong or what I need to do?

It seems that related Google API was deprecated

We will update the sample of google integration in next few days.

Great, thank you!

Hi Stanislav,

Some days ago I sent you a PM wondering for when it will be ready the update of google integration?

Thanks.

Please check
github.com/DHTMLX/scheduler-google-calendar

Thanks, but when I try to run the sample.html (downloaded from GitHub) appears in the firebug
“SyntaxError: syntax error (

regardless of whether the data.php is with the example data or mine


PD: Sorry for late reply.

I found that the error is in the file “google_proxy.php” in line 74 (please, correct it on GitHub).

(Modified code)

if (!$this->timezone) { $arr = $this->cal->calendars->get($this->cal_name); $this->timezone = $arr["timeZone"]; }

However, I have doubts about some things (how to ask for the authorization of customers, how create a new calendar from the code and get the id of it to always perform synchronization on it…) but I guess I’ll have to read the API documentation for google for accomplish this. :slight_smile:

I have added the fix to the main codebase ( without such fix it works only in latest php versions )
Thanks for the patch.

No, thank to you for always being attentive and answering me. :slight_smile:

One last question:
what should I do to get the two-way synchronization between Google Calendar and dhtmlxScheduler with the new update (github)?
… because with the current, I can only make the one-way sincronization.

Actually it must work as two way sync.

  • you need to point both load and dataprocessor to the proxy url
  • be sure that you have “edit” access for the “google api” user ( when sharing calendar it is set to read only by default )

Hi Stanislav,
My tests so far showed that the sync works only if the Google Calendar is made public. Is this true or I’m missing something?
Thanks