「サービス アカウント」でカレンダー アプリケーションを作成しようとしていて、最新バージョンの google-api-php-client をダウンロードしました
そして、serviceAccount.php にアクセスすると、次のエラーが表示されます。
致命的なエラー: 44 行目の /home/fmentert/public_html/reservations/google-api-php-client/examples/calendar/serviceAccount.php の未定義のメソッド apiClient::setAssertionCredentials() の呼び出し
これは私の serviceAccount.php ファイルです。クライアント ID、サービス アカウント名、キー ファイルを追加しました。また。const を define() に変更しました私のphpバージョンは5.2.17です
define('CLIENT_ID', '896988357842.apps.googleusercontent.com');
define('SERVICE_ACCOUNT_NAME', '896988357842@developer.gserviceaccount.com');
// Make sure you keep your key.p12 file in a secure location, and isn't
// readable by others.
define('KEY_FILE', 'bqwe3287e42d1c2342349f4c9769asdas55-privatekey.p12');
$client = new apiClient();
$client->setApplicationName("Google Prediction Sample");
// Set your cached access token. Remember to replace $_SESSION with a
// real database or memcached.
session_start();
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
// Load the key in PKCS 12 format (you need to download this from the
// Google API Console when the service account was created.
$key = file_get_contents(KEY_FILE);
$client->setAssertionCredentials(new apiAssertionCredentials( // THIS IS LINE 44
SERVICE_ACCOUNT_NAME,
array('https://www.googleapis.com/auth/prediction'),
$key)
); ....
誰が何が悪いのか知っていますか?