2012-05-14 1 views
0

저는 CakePHP에서 Zend GData API를 작동시키고 캘린더 목록을 설정하고 복원하도록했습니다.Zend Gdata 캘린더 불량 요청 오류

그 모두가 작동하지만 달력 이벤트를 검색하려고하면 잘못된 요청 오류가 발생하고 해결 방법을 모르겠습니다. 다음은 스크립트가 실행될 때 수신되는 오류 메시지 다음에 나오는 코드입니다.

* 참고 : 귀하의 시간과 도움을

Error: 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 Server: GSE Connection: close Invalid request URI

감사 : 여기

 //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++; 
     } 

XAMPP를 사용하여 내 컴퓨터에서 본을 테스트입니다하면 오류 메시지입니다.

답변

3
  1. $service->newEventQuery() 여기에는 매개 변수가 필요하지 않습니다.

  2. 나는 단일 사용자로부터 캘린더 목록을 검색한다고 생각합니다. 그것이 당신 자신이라고합시다. 그래서

    $query->setUser('default');

    당신이 어떤 두 번째 달력, 이름 귀하의 이메일 주소 대신 단지 기본 달력을 얻을 도움이되지 않습니다.

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

    그래서 사용자 ID를 대체 :

    당신은이 문서의 이전 섹션에있는 URL을 사용하여 달력하려면 다음 HTTP 요청을 보내 피드를 얻으려면 Google developer protocol guide

    에서 참조 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++; 
    }