Google CALDAV XML request using curl (php) -



Google CALDAV XML request using curl (php) -

i'm trying caldav xml request google caldav server php.

for reason google caldav poorly documented.

the purpose list of events, including event-specific data. (eg. begin, end, summary, ...). goal efficiently possible.(all event info in 1 request).

i figured out can accomplished study request.

i'm using code found in this post.

my exact code :

$xml= '<c:calendar-query xmlns:d="dav:" xmlns:c="urn:ietf:params:xml:ns:caldav"><d:prop><c:calendar-data /></d:prop></c:calendar-query>'; $url = "https://apidata.googleusercontent.com/caldav/v2/*email*/events"; $user = "**********@gmail.com"; $pw = "*********"; $data = $this->dorequest($user, $pw, $url, $xml); print_r($data); } public function dorequest($user, $pw, $url, $xml) { $c=curl_init(); $url = preg_replace('{^https?://[^/]+}', '', $url); curl_setopt($c, curlopt_url, $url); curl_setopt($c, curlopt_httpheader, array("depth: 1", "content-type: text/xml; charset='utf-8'", "prefer: return-minimal")); curl_setopt($c, curlopt_header, 0); curl_setopt($c, curlopt_ssl_verifyhost, false); curl_setopt($c, curlopt_ssl_verifypeer, false); curl_setopt($c, curlopt_httpauth, curlauth_basic); curl_setopt($c, curlopt_userpwd, $user.":".$pw); curl_setopt($c, curlopt_customrequest, "report"); curl_setopt($c, curlopt_postfields, $xml); curl_setopt($c, curlopt_returntransfer, 1); $data=curl_exec($c); curl_close($c); homecoming $data; }

the xml request copy-pasted the sabredav wiki.

what google returns on code "unknown error". know credentials google working, since tried request using sabredav's built-in requests (eg. propfind). study request cannot generated sabredav.

so think there must in xml request google caldav cannot handle properly.

i have been fiddling around several days, can't seem figure out proper solution.

well, seem using http basic auth not allowed google caldav api:

https://developers.google.com/google-apps/calendar/caldav/v2/guide#connecting_to_googles_caldav_server

then, did not specify url target of request.

php xml curl caldav sabredav

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -