Access to Address Book Server by PHP - PROPFIND (CardDAV)
I will connect with a php script - curl - to my OSX 10.8.2 address book server. But it does not work.
The problem is the Request.
The CURLOPT_CUSTOMREQUEST PROPFIND funktioniert niche, does not work, I always get the error 403
By Contacts.app access works via PROPFIND.
With PHP script that is in the log
127.0.0.1 - username [15/Feb/2013:10:18:42 +0200] "PROPFIND /addressbooks/__uids__/EF13F12C-7AF1-4CB4-A883-71309D87832B/addressbook/ HTTP/1.1" 403 97 "-" "CardDAV PHP/0.6" i=0 t=168.8 or=1 xff=192.168.1.1 fwd=192.168.1.1
By Contacts.app that is in the log
::1 - username [15/Feb/2013:10:29:07 +0200] "PROPFIND /addressbooks/__uids__/EF13F12C-7AF1-4CB4-A883-71309D87832B/ HTTP/1.1" 207 7670 "-" "Mac OS X/10.8.2 (12C60) AddressBook/1167" i=1 t=251.3 or=1 responses=2 xff=192.168.1.1 fwd=192.168.1.1
My PHP Script
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PROPFIND');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'CardDAV PHP/'.'0.6');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
I though with a curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');, then the query works.
see log
::1 - username [15/Feb/2013:10:32:13 +0200] "GET /addressbooks/__uids__/EF13F12C-7AF1-4CB4-A883-71309D87832B/addressbook/ HTTP/1.1" 200 17735 "-" "CardDAV PHP/0.6" i=1 t=190.2 or=1 xff=192.168.1.1 fwd=192.168.1.1
The Authentication on the server is Basic
serveradmin settings calendar:Authentication:Digest:Enabled = no
serveradmin settings calendar:Authentication:Basic:Enabled = yes
What is the problem?