Gdata API を使用して空のスプレッドシートを作成しようとしています。ここ (http://goo.gl/AHT7S) の他の友人と同じ問題に遭遇したため、デフォルトの Zend API はこの操作をサポートしていません。だから、私はそれを実装しようとしています。
実際、私はほとんどそれを手に入れましたが、Google サービスからこの回答があります: 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>
私はそれを行う最も簡単な方法を使用しています: クライアント ログイン + Zend_GData 関数です。私のコードは次のようになります (ばかげたことを許してください... PHP と 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);
}
操作を実行する「許可がない」理由について何か考えはありますか?