0

私は CakePHP で ZEND GData API を使用して、カレンダーのリストをセットアップして取得しようとしました。

これらはすべて機能しますが、カレンダー イベントを取得しようとすると、不適切なリクエスト エラーが発生し、解決方法がわかりません。スクリプトの実行時に表示されるエラー メッセージが続くコードを次に示します。

*注:XAMPPを使用して自分のマシンからこれをテストしています

        //GET LIST OF EVENTS
        $index = 0;
        foreach($listFeed as $list) {
            $query = $service->newEventQuery($list->link[0]->href);
            // Set different query parameters
            $query->setUser('default');
            $query->setVisibility('private');
            $query->setProjection('full');
            $query->setOrderby('starttime');

            // Get the event list
            try {
                $eventFeed[$index] = $service->getCalendarEventFeed($query);
            } catch (Zend_Gdata_App_Exception $e) {
                echo "Error: " . $e->getResponse() . "<br />";
            }
            $index++;
        }

エラーメッセージは次のとおりです。

エラー: HTTP/1.1 400 Bad Request Content-type: text/html; charset=UTF-8 Date: Mon, 14 May 2012 04:04:41 GMT Expires: Mon, 14 May 2012 04:04:41 GMT Cache-control: private, max-age=0 X-content-type-options: nosniff X-frame-options: SAMEORIGIN X-xss-protection: 1; mode=block サーバー: GSE 接続: close 無効なリクエスト URI

お時間をいただきありがとうございます。

4

1 に答える 1

3
  1. $service->newEventQuery()ここではパラメータは必要ありません。

  2. 1 人のユーザーからカレンダー リストを取得していると思います。自分だとしましょう。そう

    $query->setUser('default');

    2 番目のカレンダーを取得するのに役立ちません。代わりに、名前がメール アドレスであるプライマリ カレンダーのみを取得します。

    Google デベロッパー プロトコル ガイドから参照

    フィードを取得するには、このドキュメントの前のセクションで見つけた URL を使用して、次の HTTP リクエストをカレンダーに送信します。

    GET https://www.google.com/calendar/feeds/userID/private-magicCookie/full

    特定のカレンダーのイベント フィードを取得するには、userID を calendarID に置き換えます。

試す

    $index = 0;
    foreach($listFeed as $list) {
        $calendarID = $list->id->text;
        $user = str_replace("http://www.google.com/calendar/feeds/default/owncalendars/full/", '', $calendarID);
        $query = $service->newEventQuery();
        // Set different query parameters
        $query->setUser($user);
        $query->setVisibility('private');
        $query->setProjection('full');
        $query->setOrderby('starttime');

        // Get the event list
        try {
            $eventFeed[$index] = $service->getCalendarEventFeed($query);
        } catch (Zend_Gdata_App_Exception $e) {
            echo "Error: " . $e->getResponse() . "<br />";
        }
        $index++;
    }
于 2012-05-29T03:58:44.700 に答える