2014-10-01 125 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);