2014-10-01 124 views
0

我正在尝试设置一个连接到Google Calendar API的应用程序。Google Calendar API - PHP - “Class'apiClient'not found”

到目前为止,我有:

  • 新增客户端库和移动src文件夹到更新的config.php文件从谷歌开发者控制台中的所有相关信息我的工作目录
  • 建立一个index.php文件与下面的代码文件夹中,只跑了文件,我期待这产生的OAuth屏幕登录,但是我得到了一个空白屏幕和一个错误在我的日志

Class 'apiClient' not found...

的index.php

<?php 
    set_include_path('src'); 
    require_once "Google/Client.php"; 
    require_once "Google/Service/Calendar.php"; 

    $apiClient = new apiClient(); <---LINE CAUSING THE ERROR 
    $apiClient->setUseObjects(true); 
    $service = new apiCalendarService($apiClient); 

    if (isset($_SESSION['oauth_access_token'])) { 
     $apiClient->setAccessToken($_SESSION['oauth_access_token']); 
    } else { 
     $token = $apiClient->authenticate(); 
     $_SESSION['oauth_access_token'] = $token; 
    }  
?> 
+0

本示例使用Google Analytics API,但它可能会帮助您获取Oauth流量。如果您仍然无法使用它,请告诉我,我会看看我是否可以制作日历教程http://www.daimto.com/google-oauth2-php/ – DaImTo 2014-10-01 11:54:21

回答

0

我刚刚发现这个问题了。发生的是他们已经更新了API,但没有更新文档。尝试更改包含内容到

$g_Client = new Google_Client(); 
$g_Cal = new Google_CalendarService($g_Client);