嘿似乎无法使用此代码创建一个事件,
<?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@email.com');
//$attendees = array($attendee1);
//$event->attendees = $attendees;
$createdEvent = $cal->events->insert('primary', $event);
echo $createdEvent->getId();
$_SESSION['token'] = $client->getAccessToken();
}
?>
继续收到此错误消息:
致命错误:未捕获异常'apiIOException',消息'HTTP错误:(0)SSL证书问题,验证CA证书是否正常。详细信息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败'在C:\ Program Files \ EasyPHP-5.3.9 \ www \ google-api-php-client \ src \ io \ apiCurlIO.php:119堆栈跟踪: #0 C:\ Program Files \ EasyPHP-5.3.9 \ www \ google-api-php-client \ src \ io \ apiCurlIO.php(56):apiCurlIO-&gt; makeRequest(Object(apiHttpRequest))#1C: \ Program Files \ EasyPHP-5.3.9 \ www \ google-api-php-client \ src \ io \ apiREST.php(55):apiCurlIO-&gt; 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-&gt; __ call('insert',Array)#4 C:\ Program Files \ EasyPHP-5.3.9 \ www \ eventNew.php(47):EventsServiceResource-&gt; insert('primary',Object(Event))#5 {main}抛出C:\ Program Files \ EasyPHP-5.3.9 \ www \ google-api-php-client第119行的\ src \ io \ apiCurlIO.php
答案 0 :(得分:2)
似乎您的Windows上的PHP版本未设置为验证对等SSL证书。
this link处有一些信息描述了如何解决问题。
基本上,您需要在Windows计算机上安装CA捆绑包,然后在代码中添加一行,告诉它在哪里查找CA捆绑包。
答案 1 :(得分:0)
某些程序已经有了CA捆绑包。
在我出现此问题之前,我已经使用过GIT证书包。