The PHP WebDAV extension allows easy access to remote resources with PHP through the DAV protocol.
Installation and sample usage
This extension requires the Neon library and the related header files.
Neon can be downloaded from: http://www.webdav.org/neon/
Pre-built packages and ports are already available for most operating systems
and distributions.
In order to compile and install the PHP WebDAV extension, just follow the
standard PECL procedure :
$ phpize
$ ./configure –enable-dav
# make install
On OpenBSD systems, use
$ env AUTOCONF_VERSION=2.61 phpize
(replace 2.61 with any of the currently installed versions of autoconf on your system)
Basic example
webdav_connect(‘http://webdav.example.com/dav’, ‘davuser’, ‘davpassword’);
$a = webdav_get(‘/my/nice/object.txt’);
webdav_put(‘/your/nice/thing.txt’, $data);
webdav_unlink(‘/unwanted_resource.txt’);
webdav_rename(‘/dir/old_name’, ‘/dir/new_name’);
webdav_copy(‘/dir/orig_dir’, ‘/dir/new_dir’, TRUE);
webdav_close();
Named resource example
$res = webdav_connect(‘http://webdav.example.com/dav’, ‘davuser’, ‘davpassword’);
$a = webdav_get(‘/my/nice/object.txt’, $res);
webdav_put(‘/your/nice/thing.txt’, $data, $res);
webdav_unlink(‘/unwanted_resource.txt’, $res);
webdav_rename(‘/dir/old_name’, ‘/dir/new_name’, $res);
webdav_copy(‘/dir/orig_dir’, ‘/dir/new_dir’, TRUE, $res);
webdav_close($res);