0

CalDav get calendar events

Hi

I'm trying to get the event details from the yahoo calendar using the next code.

$body = <<<EOXML
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query <xmlns:D=>"DAV:" <xmlns:C=>"<urn:ietf>:<params:xml>:ns:caldav">
    <D:prop>
        <C:calendar-data>
            <C:comp name="VCALENDAR">
                <C:prop name="VERSION"/>
                <C:comp name="VEVENT">
                    <C:prop name="SUMMARY"/>
                    <C:prop name="UID"/>
                    <C:prop name="DTSTART"/>
                    <C:prop name="DTEND"/>
                    <C:prop name="DURATION"/>
                    <C:prop name="RRULE"/>
                    <C:prop name="RDATE"/>
                    <C:prop name="EXRULE"/>
                    <C:prop name="EXDATE"/>
                    <C:prop name="LOCATION"/>
                    <C:prop name="RECURRENCE-ID"/>
                </C:comp>
                <C:comp name="VTIMEZONE"/>
            </C:comp>
        </C:calendar-data>
    </D:prop>  
    <C:filter>
        <C:comp-filter name="VCALENDAR">
            <C:comp-filter name="VEVENT">
                <C:time-range start="20140501T000000Z" end="20150507T000000Z"/>
            </C:comp-filter>
        </C:comp-filter>
    </C:filter>
</C:calendar-query>
EOXML;

$headers = array(
    'Depth: 1',
    'Content-Type: application/xml; charset=utf-8',
    'Content-Length: '.strlen($body),
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$result = 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, 'REPORT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
$result = curl_exec($ch);
curl_close($ch);

However i only get the .ics links and not the details of the events. The code works for other CalDav severs (e.g. ICloud). So... am I missing something here?

Kind regards, Sammy

by
0 Replies

Recent Posts

in General Discussion at YDN