All posts by Ron Metten

Connecting to a CalDAV Server with cURL

After installing Baikal as a CalDAV/CardDAV server, I tested the connectivity to this server with cURL. I used SSL with a self-signed certificate on the web server, authentification on the CalDAV server was set to DIGEST.

This is being reflected in the cURL request by using –insecure to address the self-signed certificate and –digest for the DIGEST authentification method, when requesting the username:

--request PROPFIND
--header "Content-Type: text/xml"
--header "Brief:t"
--data "<D:propfind xmlns:D='DAV:'><D:prop><D:displayname/></D:prop></D:propfind>"

USERNAME and PASSWORD are eponymous placeholders, the object in the URL path (cal.php/principals/USERNAME) is specific for Baikal server.

The result of this query:

<?xml version="1.0" encoding="utf-8"?>
 xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs=""
    <d:displayname>Ron Metten</d:displayname>
   <d:status>HTTP/1.1 200 OK</d:status>

Get current working directory in PHP with Phing

The ResolvePathTask in Phing “turns a relative path into an absolute path, with respect to specified directory or the project basedir (if no dir attribute specified)”.

We can use this to dynamically get a base path for relative path components:

<property name="URI.base" value="./"/>
<resolvepath propertyName="URI.base" file="${URI.base}"/>

With this, we compose absolute paths:

<property name="URI.utilities" value="${URI.base}/utilities"/>


<project name="sandbox" default="main">
 <target name="sandbox_init" description="Init build and set properties">
  <property name="URI.base" value="./"/>
  <resolvepath propertyName="URI.base" file="${URI.base}"/>
  <echo>Resolved [absolute] path: ${URI.base}</echo>
  <!-- Directories -->
  <property name="URI.utilities" value="${URI.base}/utilities"/>
  <echo>Utilities path: ${URI.utilities}</echo>
  <!--File names -->
  <property name="URI.autoload.outfile" value="${URI.utilities}/"/>
  <property name="URI.autoload.templatefile" value="${URI.utilities}/autoload.template.tpl"/>
 <target name="main" depends="sandbox_init" description="Main build task"/>

The above code sample prints:
Buildfile: /var/www/sandbox/build.xml
sandbox > sandbox_init:
[echo] Resolved [absolute] path: /var/www/sandbox
[echo] Utilities path: /var/www/sandbox/utilities