0

APIを介してGoogleドキュメントとやり取りするWebアプリケーションを開発しています。Zend_Gdata にはドキュメントの共有許可を変更するメソッドがないため、次のように POST メソッドを使用する必要があります。

POST /feeds/default/private/full/resource_id/acl HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/acl/2007#accessRule'/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='user' value='new_writer@example.com'/>
</entry>

どこでこれを行うのですか?PHPにはPOST関数がありますか? それを行うにはcurlを使用する必要がありますか?そしてどうやって?

前もって感謝します

4

1 に答える 1

0

PHP は何でもできます。

$url = "http://docs.google.com/feeds/default/private/full/resource_id/acl";

$headers = array("GData-Version: 3.0",
"Authorization: <your authorization header here>");

$body = "<entry xmlns="http://www.w3.org/2005/Atom"         
xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/acl/2007#accessRule'/>
    <gAcl:role value='writer'/>
    <gAcl:scope type='user' value='new_writer@example.com'/>
  </entry>";

// main options
curl_setopt($this->curl, CURLOPT_URL, $url);
curl_setopt($this->curl, CURLOPT_POST, true);
curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers);
if (!empty($body)) curl_setopt($this->curl, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($this->curl);

http://www.php.net/manual/en/book.curl.php

于 2011-05-10T12:05:01.743 に答える