2010-12-08 31 views
0

Ich entwickle eine Webanwendung, die mit Google Docs über API interagiert. Wie Zend_Gdata haben keine Methoden, um die gemeinsame Nutzung permitions von Dokumenten zu ändern, die ich die POST-Methode wie folgt verwenden müssen:Google Docs POST Anfrage

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='[email protected]'/> 
</entry> 

Wo genau kann ich das tun? Hat PHP eine POST-Funktion? Sollte ich Curl verwenden, um es zu tun? und wie?

Vielen Dank im Voraus

Antwort

0

PHP kann alles.

$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='[email protected]'/> 
    </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

Verwandte Themen