2011-08-31 9 views
0

Gdata API를 사용하여 빈 스프레드 시트를 만들려고합니다. 다른 친구 (http://goo.gl/AHT7S)와 동일한 문제가 발생 했으므로 기본 Zend API는이 작업을 지원하지 않습니다. 그래서 구현하려고합니다. Gdata 서비스를 사용하여 문서 작성 권한이 거부되었습니다.

사실 나는 우리가 거의있어었지만 나는 구글 서비스에서이 답변이 있습니다 : - 클라이언트 로그인 + Zend_GData 기능 (403) 내가 그 일을 가장 간단한 방법을 사용하고 <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>You do not have permission to perform this operation.</internalReason></error></errors>

합니다. 나는이 작업을 실행 "권한이 없습니다"이유에 대해 어떤 생각이

public function newSpreadsheet($name){ 

      $line = "\n"; 
      $tab = "\t"; 
      $token = 'GoogleLogin auth=' . $this->login->getLoginToken(); 

      $headers = array(); 
      $headers['GData-Version'] = "3.0"; 
      $headers['Authorization'] = $token; 
      $headers['Content-Length'] = '287'; 
      $headers['Content-Type'] = 'application/atom+xml'; 

      $url = 'https://docs.google.com/feeds/default/private/full'; 

      $body = "<?xml version='1.0' encoding='UTF-8'?>".$line; 
      $body .= "<entry xmlns='http://www.w3.org/2005/Atom'>".$line; 
      $body .= $tab. "<category scheme='http://schemas.google.com/g/2005#kind'".$line; 
      $body .= $tab.$tab."term='http://schemas.google.com/docs/2007#document'/>".$line; 
      $body .= $tab."<title>".$name."</title>".$line; 
      $body .= "</entry>"; 

      echo $body; 

      return parent::performHttpRequest('POST',$url,$headers,$body); 
} 

있습니까 : 내 코드 (... 내가 PHP와의 GData의 새로운이야 어떤 바보 같은 일을 용서하시기 바랍니다) 이렇게되면?

답변

1

아마도 HTTP 요청을 수행하는 대신 API를 사용하여 빈 스프레드 시트를 업로드하려고합니다.

여기에서 자세한 내용을 참조하십시오

http://code.google.com/apis/documents/docs/1.0/developers_guide_php.html#UploadingSpreadsheet

+0

이이 Elizeu입니다. 내가 말했듯이, 나는 이것에 대해 새롭고이 "업로드 도구"는 검사되지 않았습니다. 나는 그것을 작동하게하고 나서 소프트웨어를 계속 사용할 수 있습니다. 어쩌면 누군가 위의 코드 구현을 도울 수 있기 때문에 이것을 올바른 답으로 표시하지 않을 것입니다. 하지만 정말 고맙습니다. – Nigini

관련 문제