Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Of course after spending hours on a problem and resorting to SO, your brain kicks in.</p> <p>I was missing the $uid var, needs to be set to a unique (or existing to update) event ID. The below should work for anyone else trying to achieve the same thing:</p> <pre><code>&lt;?php $account = array( 'server'=&gt; 'p05', 'id' =&gt; '######', 'user' =&gt; 'a****z@me.com', 'pass' =&gt; '*****' ); $uid = 'event-12345'; $url = 'https://'.$account['server'].'-caldav.icloud.com/'.$account['id'].'/calendars/work/' . $uid . '.ics'; $userpwd = $account['user'] .":". $account['pass']; $description = 'Test event description'; $summary = 'Test event'; $tstart = gmdate("Ymd\THis\Z", strtotime("-2 days")); $tend = gmdate("Ymd\THis\Z", strtotime("-2 days")); $tstamp = gmdate("Ymd\THis\Z"); $body = &lt;&lt;&lt;__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_exec($ch); curl_close($ch); ?&gt; </code></pre> <p>My mistake.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload