This package looks terrific. I tried it once years ago, and am now trying again.
pear install HTTP_WebDAV_Server vim /usr/share/php/docs/HTTP_WebDAV_Server/db/Fileserver.sql
I installed the database, and then tried the simple script offered here:
How to install a webdav server in php
Since I run PHP as a CGI script, I had to add this snibbet I found at the php.net website:
if (!function_exists('apache_request_headers')) { eval(' function apache_request_headers() { foreach($_SERVER as $key=>$value) { if (substr($key,0,5)=="HTTP_") { $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); $out[$key]=$value; } } return $out; } '); }
Reading through the docs again, the Server/Filesystem.php file is just an example of how the Server.php class can be extended. I copied this file to my working directory, started to make a few changes, and some cool ideas came to mind:
There are many opportunities for coolness here. I'm going to get started on something boring yet important: file uploads. To do this I'm actually going to use the HTTP_WebDAV_Client package from PEAR as well. It simply registers the webdav: and webdavs: protocols so you can do stuff like this:
$httpfile = file_get_contents("webdav://www.example.com/foo.txt");
¥