开发者

Permission denied for document creation using Gdata services

I'm trying to create an empty Spreadsheet using Gdata API. As I've reached the same problem as this other friend here (http://goo.gl/AHT7S) the default Zend API do not support this operation. So, I'm trying to implement it.

Actually I fell we almost got it, but I have this answer from google service: 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>

I'm using the 开发者_Python百科most simple way of doing it: client login + Zend_GData functions. My code goes like this (please forgive any dumb thing... I'm new in PHP and GData):

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);
}

Is there any idea on why I "do not have permission" to execute the operation?


Perhaps, you want to try to upload an empty spreadsheet using the API, instead of performing a HTTP request.

See more details here:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜