Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Communication with Kerio caldav interface results in 501 responses
  •  
Preexo

Messages: 25
Karma: -1
Send a private message to this user
I would really love to talk to the caldav server of Kerio via php from another server. So far I had no luck at all. I made a script from a couple of links that I found scattered around this forum and the rest of the internet. Most of it is a copy of http://trentrichardson.com/2012/06/22/put-caldav-events-to-c alendar-in-php/
But I have no idea how much of that is actually still supposed to work and I couldn't find anymore documentation about something like this.
So pointing me to the right documents would also be very much appreciated, thanks!

This php script results in
* upload completely sent off: 233 out of 233 bytes
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 501 Not Implemented
< Connection: Close
< Content-Type: text/html
< Date: Fri, 7 Aug 2015 10:40:09 GMT
< Server: Kerio Connect 8.5.1
< X-UA-Compatible: IE=edge
<
* nread <= 0, server closed connection, bailing
* Closing connection #0



$account['uri'] = "http://192.168.10.11/caldav/users/changeddomain.com/tim";
$account['user'] = "tim";
$account['pass'] = "changedpassword";

$uid = "test-12345"; // setting this to an existing uid updates event, a new uid adds event
$url = $account['uri'].'/'.$uid.'.ics'; 
$userpwd = $account['user'] .":". $account['pass'];
$description = 'My event description here';
$summary = 'My event title 1';
$tstart = '201508015T000000Z';
$tend = '20150816T000000Z';
$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;

$headers = array(
    'Content-Type: text/calendar; charset=utf-8',
    'If-None-Match: *',
    'Expect: ',
    'Content-Length: '.strlen($body),
);

$ch = curl_init();
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_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$ret = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
var_dump($ret, $error);exit;


Any idea why I get the 501 response for this? What am I missing?
  •  
Pavel Dobry (Kerio)

Messages: 5240
Karma: 251
Send a private message to this user
URL /caldav/users/changeddomain.com/tim should be used for getting calendar resources from the server. For putting new events to the calendar you must use URL for that calendar (as returned in request for /caldav URL when listing resources).
  •  
Preexo

Messages: 25
Karma: -1
Send a private message to this user
So I need to request the calendar resources first, look into the data and find a URL in there which then can be used to add new events to a calendar? Did I understand that correct?

Thanks very much for help!

[Updated on: Mon, 10 August 2015 11:09]

Previous Topic: Outlook Internet calendar and Kerio Connect
Next Topic: Error 28110 with Windows 10 and Outlook 2013 and Kerio 8.5.1
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Wed May 24 10:07:32 CEST 2017

Total time taken to generate the page: 0.00926 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.