PHPでGoogleカレンダーを操作する
Posted by Toc on 10 月 23, 2008 in Zend Framework |
RubyでGoogleカレンダーを操作する、
PythonでGoogleカレンダーを操作する
というエントリーがあったので、PHP版のたたき台も。
ZendFrameworkを使用。
<?php require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); $user = 'your_user_name'; $pass = 'your_password'; $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); $calendar = new Zend_Gdata_Calendar($client); echo "イベント一覧:\n\n"; foreach ($calendar->getCalendarEventFeed() as $event) { printf("[%s - %s] %s\n", date('Y-m-d H:i:s', strtotime($event->when[0]->startTime)), date('Y-m-d H:i:s', strtotime($event->when[0]->endTime)), $event->title ); }
更新系の操作もできるみたいです。詳細は公式ドキュメントで。