2012-03-01 22 views
2

を追加カントちょっとこのコードでイベントを作成するように見えるカント、GoogleカレンダーのAPI v3には、イベントのphp

<?php 
require_once 'google-api-php-client/src/apiClient.php' 
require_once 'google-api-php-client/src/contrib/apiCalendarService.php'; 
session_start(); 
$client = new apiClient(); 
$client->setApplicationName("Cal"); 
$client->setClientId(''); 
$client->setClientSecret(''); 
//$client->setRedirectUri('http://localhost:8080/createEvent.php'); 
$client->setRedirectUri('http://localhost:8080/eventNew.php'); 
//http://localhost:8080/oauth2callback'); 
$client->setDeveloperKey(''); 
$cal = new apiCalendarService($client); 

if (isset($_GET['logout'])) { 
    unset($_SESSION['token']); 
} 

if (isset($_GET['code'])) { 
    $client->authenticate(); 
    $_SESSION['token'] = $client->getAccessToken(); 
    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); 
} 

if (isset($_SESSION['token'])) { 
    $client->setAccessToken($_SESSION['token']); 
} 

$authUrl = $client->createAuthUrl(); 

if (!$client->getAccessToken()) { 

$event = new Event(); 
$event->setSummary("test title"); 
$event->setLocation("test location"); 
$start = new EventDateTime(); 
$start->setDateTime('04-03-2012 09:25:00:000 -05:00'); 
$event->setStart($start); 
$end = new EventDateTime(); 
$end->setDateTime('04-03-2012 10:25:00:000 -05:00'); 
$event->setEnd($end); 
//$attendee1 = new EventAttendee(); 
//$attendee1->setEmail('[email protected]'); 
//$attendees = array($attendee1); 
//$event->attendees = $attendees; 
$createdEvent = $cal->events->insert('primary', $event); 

echo $createdEvent->getId(); 

$_SESSION['token'] = $client->getAccessToken(); 
} 
?> 

このエラーメッセージになってください:

Fatal error: Uncaught exception 'apiIOException' with message 'HTTP Error: (0) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\io\apiCurlIO.php:119 Stack trace: #0 C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\io\apiCurlIO.php(56): apiCurlIO->makeRequest(Object(apiHttpRequest)) #1 C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\io\apiREST.php(55): apiCurlIO->authenticatedRequest(Object(apiHttpRequest)) #2 C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\service\apiServiceResource.php(186): apiREST::execute(Object(apiServiceRequest)) #3 C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\contrib\apiCalendarService.php(493): apiServiceResource->__call('insert', Array) #4 C:\Program Files\EasyPHP-5.3.9\www\eventNew.php(47): EventsServiceResource->insert('primary', Object(Event)) #5 {main} thrown in C:\Program Files\EasyPHP-5.3.9\www\google-api-php-client\src\io\apiCurlIO.php on line 119

答えて

2

をそれは、PHP上のバージョンと思われますWindowsはピアSSL証明書を検証するように設定されていません。

this linkには、問題の解決方法が記載されています。

基本的に、WindowsマシンにCAバンドルをインストールしてから、コードに1行追加してCAバンドルを検索する場所を指定する必要があります。

0

一部のプログラムには、すでにCAバンドルが含まれています。

私はこの問題が発生していた前にGIT証明書バンドルを使用しました。

関連する問題