Добавление событий на байкальский сервер CalDAV с использованием PHP

Я хочу переместить события в календарь CalDAV, который установлен на моем веб-хосте. Я использую байкальский сервер CalDAV.

Это мой PHP:

<?php $uid = "test-12345"; // setting this to an existing uid updates event, a new uid adds event $url = "http://infobo9.myhostpoint.ch/dav/cal.php/principals/bookify"; //http://mail.domain.com/calendars/DOMAIN/USER/Calendar/'.$uid.'.ics' $userpwd = "bookify:test"; $description = 'My event description here'; $summary = 'My event title 1'; $tstart = '20141127T000000Z'; $tend = '20141127T000000Z'; $tstamp = gmdate("Ymd\THis\Z"); $body = "<<<__EOD BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT DTSTAMP:$tstamp DTSTART:$tstart DTEND:$tend UID:$uid DESCRIPTION:$description LOCATION:Office SUMMARY:$summary END:VEVENT END:VCALENDAR __EOD"; echo $body . "<br>"; $headers = array( 'Content-Type: text/calendar; charset=utf-8', 'If-None-Match: *', 'Expect: ', 'Content-Length: '.strlen($body), ); $fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w'); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $userpwd); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); curl_exec($ch); curl_close($ch); echo "done" ?> 

Выход PHP:

 <<<__EOD BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT DTSTAMP:20141127T181856Z DTSTART:20141127T000000Z DTEND:20141127T000000Z UID:test-12345 DESCRIPTION:My event description here LOCATION:Office SUMMARY:My event title 1 END:VEVENT END:VCALENDAR __EOD done 

Я получаю это как вывод CURL:

 * About to connect() to infobo9.myhostpoint.ch port 80 (#0) * Trying 217.26.52.30... * connected * Connected to infobo9.myhostpoint.ch (217.26.52.30) port 80 (#0) * Server auth using Basic with user 'bookify' > PUT /dav/cal.php/principals/bookify HTTP/1.1 Host: infobo9.myhostpoint.ch Accept: */* Content-Type: text/calendar; charset=utf-8 If-None-Match: * Content-Length: 260 < HTTP/1.1 200 OK < Date: Thu, 27 Nov 2014 18:02:16 GMT < Server: Apache/2.2.29 (FreeBSD) DAV/2 mod_ssl/2.2.29 OpenSSL/1.0.1j mod_hcgi/0.9.4 < X-Powered-By: PHP/5.4.32 < Set-Cookie: PHPSESSID=j2q0hmd7tvvo2egbf521tj5q82; path=/; HttpOnly < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < Pragma: no-cache < Transfer-Encoding: chunked < Content-Type: text/html < * Connection #0 to host infobo9.myhostpoint.ch left intact * Closing connection #0 

Событие не добавляется на сервер CalDAV. Любая идея, почему это не работает?

Проблема в том, что URL-адрес был неправильным. Правильный URL:

 http://<domain>/dav/cal.php/calendars/<username>/<calendar-name>/<event-id>.ics 

Я использовал другой способ аутентификации и работы в версии 0.2.7

Я переключился на CURLAUTH_DIGEST

Были ли регулярные корректировки auguns erroos, возвращаемые PHP.

Сейчас он отлично работает