Overview

Packages

  • awl
    • caldav-client-v2
    • RRule
  • davical
    • authentication
      • drivers
    • caldav
    • DAViCalSession
    • DAVTicket
    • external-bind
    • feed
    • HTTPAuthSession
    • iSchedule
    • iSchedule-POST
    • logging
    • metrics
    • Principal
    • propfind
    • PublicSession
    • Request
    • Resource
    • tzservice
  • None

Classes

  • CalDAVClient
  • CalendarInfo
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class CalDAVClient

A class for accessing DAViCal via CalDAV, as a client

Package: awl\caldav-client-v2
Copyright: Andrew McMillan
License: GNU LGPL version 3 or later
Author: Andrew McMillan andrew@mcmillan.net.nz
Located at caldav-client-v2.php
Methods summary
public
# __construct( string $base_url, string $user, string $pass )

Constructor, initialises the class

Constructor, initialises the class

Parameters

$base_url
The URL for the calendar server
$user
The name of the user logging in
$pass
The password for that user
public boolean
# SetDebug( boolean $new_value )

Call this to enable / disable debugging. It will return the prior value of the debugging flag.

Call this to enable / disable debugging. It will return the prior value of the debugging flag.

Parameters

$new_value
The new value for debugging.

Returns

boolean
The previous value, in case you want to restore it later.
public
# SetMatch( boolean $match, string $etag = '*' )

Adds an If-Match or If-None-Match header

Adds an If-Match or If-None-Match header

Parameters

$match
to Match or Not to Match, that is the question!
$etag
The etag to match / not match against.
public
# SetDepth( integer $depth = '0' )

Add a Depth: header. Valid values are 0, 1 or infinity

Add a Depth: header. Valid values are 0, 1 or infinity

Parameters

$depth
The depth, default to infinity
public
# SetUserAgent( integer $user_agent = null )

Add a Depth: header. Valid values are 1 or infinity

Add a Depth: header. Valid values are 1 or infinity

Parameters

$user_agent
$depth The depth, default to infinity
public
# SetContentType( string $type )

Add a Content-type: header.

Add a Content-type: header.

Parameters

$type
The content type
public
# SetCalendar( string $url )

Set the calendar_url we will be using for a while.

Set the calendar_url we will be using for a while.

Parameters

$url
The calendar_url
public
# ParseResponse( string $response )

Split response into httpResponse and xmlResponse

Split response into httpResponse and xmlResponse

Parameters

$response
from server
public array
# ParseResponseHeaders( )

Split httpResponseHeaders into an array of headers

Split httpResponseHeaders into an array of headers

Returns

array
of arrays of header lines
public HTTP
# GetHttpRequest( )

Output http request headers

Output http request headers

Returns

HTTP
headers
public HTTP
# GetResponseHeaders( )

Output http response headers

Output http response headers

Returns

HTTP
headers
public HTTP
# GetResponseBody( )

Output http response body

Output http response body

Returns

HTTP
body
public raw
# GetXmlRequest( )

Output xml request

Output xml request

Returns

raw
xml
public raw
# GetXmlResponse( )

Output xml response

Output xml response

Returns

raw
xml
public string
# DoRequest( string $url = null )

Send a request to the server

Send a request to the server

Parameters

$url
The URL to make the request to

Returns

string
The content of the response from the server
public
# Unchunk( )

Unchunk a chunked response

Unchunk a chunked response

public array
# DoOptionsRequest( string $url = null )

Send an OPTIONS request to the server

Send an OPTIONS request to the server

Parameters

$url
The URL to make the request to

Returns

array
The allowed options
public array
# DoXMLRequest( string $request_method, string $xml, string $url = null )

Send an XML request to the server (e.g. PROPFIND, REPORT, MKCALENDAR)

Send an XML request to the server (e.g. PROPFIND, REPORT, MKCALENDAR)

Parameters

$request_method
$method The method (PROPFIND, REPORT, etc) to use with the request
$xml
The XML to send along with the request
$url
The URL to make the request to

Returns

array
An array of the allowed methods
public
# DoGETRequest( string $url )

Get a single item from the server.

Get a single item from the server.

Parameters

$url
The URL to GET
public
# DoHEADRequest( string $url )

Get the HEAD of a single item from the server.

Get the HEAD of a single item from the server.

Parameters

$url
The URL to HEAD
public string
# DoPUTRequest( string $url, string $icalendar, string $etag = null )

PUT a text/icalendar resource, returning the etag

PUT a text/icalendar resource, returning the etag

Parameters

$url
The URL to make the request to
$icalendar
The iCalendar resource to send to the server
$etag
The etag of an existing resource to be overwritten, or '*' for a new resource.

Returns

string
The content of the response from the server
public integer
# DoDELETERequest( string $url, string $etag = null )

DELETE a text/icalendar resource

DELETE a text/icalendar resource

Parameters

$url
The URL to make the request to
$etag
The etag of an existing resource to be deleted, or '*' for any resource at that URL.

Returns

integer
The HTTP Result Code for the DELETE
public
# DoPROPFINDRequest( string $url, $props, $depth = 0 )

Get a single item from the server.

Get a single item from the server.

Parameters

$url
The URL to PROPFIND on
$props
$depth
public
# PrincipalURL( $url = null )

Get/Set the Principal URL

Get/Set the Principal URL

Parameters

$url
The Principal URL to set
public
# CalendarHomeSet( $urls = null )

Get/Set the calendar-home-set URL

Get/Set the calendar-home-set URL

Parameters

$urls
of string The calendar-home-set URLs to set
public
# CalendarUrls( $urls = null )

Get/Set the calendar-home-set URL

Get/Set the calendar-home-set URL

Parameters

$urls
of string The calendar URLs to set
public
# HrefValueInside( string $tagname )

Return the first occurrence of an href inside the named tag.

Return the first occurrence of an href inside the named tag.

Parameters

$tagname
The tag name to find the href inside of
public
# HrefForProp( string $tagname, integer $i = 0 )

Return the href containing this property. Except only if it's inside a status != 200

Return the href containing this property. Except only if it's inside a status != 200

Parameters

$tagname
The tag name of the property to find the href for
$i
$which Which instance of the tag should we use
public
# HrefForResourcetype( string $tagname, integer $i = 0 )

Return the href which has a resourcetype of the specified type

Return the href which has a resourcetype of the specified type

Parameters

$tagname
The tag name of the resourcetype to find the href for
$i
$which Which instance of the tag should we use
public
# GetOKProps( string $nodenum )

Return the ... of a propstat where the status is OK

Return the ... of a propstat where the status is OK

Parameters

$nodenum
The node number in the xmlnodes which is the href
public
# FindPrincipal( string $url = null )

Attack the given URL in an attempt to find a principal URL

Attack the given URL in an attempt to find a principal URL

Parameters

$url
The URL to find the principal-URL from
public
# FindCalendarHome( string $recursed = false )

Attack the given URL in an attempt to find a principal URL

Attack the given URL in an attempt to find a principal URL

Parameters

$recursed
$url The URL to find the calendar-home-set from
public
# FindCalendars( $recursed = false )

Find the calendars, from the calendar_home_set

Find the calendars, from the calendar_home_set

public
# GetCalendarDetails( $url = null )

Find the calendars, from the calendar_home_set

Find the calendars, from the calendar_home_set

public
# GetCollectionETags( $url = null )

Get all etags for a calendar

Get all etags for a calendar

public
# CalendarMultiget( $event_hrefs, $url = null )

Get a bunch of events for a calendar with a calendar-multiget report

Get a bunch of events for a calendar with a calendar-multiget report

public array
# DoCalendarQuery( string $filter, string $url = '' )

Given XML for a calendar query, return an array of the events (/todos) in the response. Each event in the array will have a 'href', 'etag' and '$response_type' part, where the 'href' is relative to the calendar and the '$response_type' contains the definition of the calendar data in iCalendar format.

Given XML for a calendar query, return an array of the events (/todos) in the response. Each event in the array will have a 'href', 'etag' and '$response_type' part, where the 'href' is relative to the calendar and the '$response_type' contains the definition of the calendar data in iCalendar format.

Parameters

$filter
XML fragment which is the element of a calendar-query
$url
The URL of the calendar, or empty/null to use the 'current' calendar_url

Returns

array

An array of the relative URLs, etags, and events from the server. Each element of the array will be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied etag (which only varies when the data changes) and the calendar data in iCalendar format.

public array
# GetEvents( timestamp $start = null, timestamp $finish = null, string $relative_url = '' )

Get the events in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Get the events in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Parameters

$start
The start time for the period
$finish
The finish time for the period
$relative_url
The URL relative to the base_url specified when the calendar was opened. Default ''.

Returns

array
An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()
public array
# GetTodos( timestamp $start, timestamp $finish, boolean $completed = false, boolean $cancelled = false, string $relative_url = "" )

Get the todo's in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Get the todo's in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Parameters

$start
The start time for the period
$finish
The finish time for the period
$completed
Whether to include completed tasks
$cancelled
Whether to include cancelled tasks
$relative_url
The URL relative to the base_url specified when the calendar was opened. Default ''.

Returns

array
An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()
public array
# GetEntryByUid( uid $uid, string $relative_url = '', string $component_type = 'VEVENT' )

Get the calendar entry by UID

Get the calendar entry by UID

Parameters

$uid
$relative_url
The URL relative to the base_url specified when the calendar was opened. Default ''.
$component_type
The component type inside the VCALENDAR. Default 'VEVENT'.

Returns

array
An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery()
public string
# GetEntryByHref( string $href )

Get the calendar entry by HREF

Get the calendar entry by HREF

Parameters

$href
The href from a call to GetEvents or GetTodos etc.

Returns

string
The iCalendar of the calendar entry
Properties summary
protected string $base_url

Server, username, password, calendar

Server, username, password, calendar

#
protected $user
#
protected $pass
#
protected $entry
#
protected $protocol
#
protected $server
#
protected $port
#
protected $principal_url

The principal-URL we're using

The principal-URL we're using

#
protected $calendar_url

The calendar-URL we're using

The calendar-URL we're using

#
protected $calendar_home_set

The calendar-home-set we're using

The calendar-home-set we're using

#
protected $calendar_urls

The calendar_urls we have discovered

The calendar_urls we have discovered

#
public string $user_agent

The useragent which is send to the caldav server

The useragent which is send to the caldav server

# 'DAViCalClient'
protected array $headers
# array()
protected string $body
# ""
protected string $requestMethod
# "GET"
protected string $httpRequest
# ""
protected string $xmlRequest
# ""
protected string $xmlResponse
# ""
protected integer $httpResponseCode
# 0
protected string $httpResponseHeaders
# ""
protected $httpParsedHeaders
#
protected string $httpResponseBody
# ""
protected $parser
#
DAViCal API documentation generated by ApiGen