Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Connect to Google Calendar PHP/API

Tags:

php

calendar

Good day to you all :)

So I was using the following code to insert events into my Google Calendar. This all worked last week. This week, I have built a new computer and updated all PHP, MySQL and Apache. I am now getting the error "Cannot Connect to Calendar", which you can see is a custom error message at the end of this code example. The rest of the script deals with data processing and insertion.

I've checked the code with examples online and it matches. The username and password are correct and I can login via various browsers. Can anyone help me to get this back up and running and allowing me to connect to the Calendar?

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$user = '[email protected]';
$pass = '<removed>';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;


$calendar_user = "valid%40email.address.com"; // Also tried with @
//$calendar_visibility = "private-<removed>";


try {
    $client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);          
    }
catch(Exception $e) {
    // prevent Google username and password from being displayed 
            // if a problem occurs
    echo "Could not connect to calendar.";
    die();
    }

For reference. It's a clean Windows 7 install now running the lastest (Nov 2012) version of WAMP. I am able to run local PHP scripts that connect, successfully, to remote databases. And the file 'Zend/Loader.php' is present with the correct path.

Any help greatly appreciated. TIA

------ UPDATE ----

Turned off the custom error message and get this:

 Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message ' in C:\Program Files (x86)\wamp\www\www.domain.com\subdir\Zend\Gdata\App.php on line 709

Running on the latest WAMP. I've enabled the SSL Module but nothing has changed.

like image 895
Biomech Avatar asked Aug 04 '26 12:08

Biomech


1 Answers

SOLVED

For the benefit of anyone else who finds this...

SSL was showing to be uncommented and fully supported in both PHPinfo() and the WAMP dashboard. However, it appears that WAMP needed to be explicitly told that it was enabled. After insuring that you actually installed WAMP/PHP with SSL support then...

Click on the WAMP tray - PHP - extensions - [tick/enable] php_openssl.dll

Restart WAMP.

Now all works as it did in the past.

like image 155
Biomech Avatar answered Aug 07 '26 02:08

Biomech