Hello All
I'm trying to get a WebDAV server set up using PEAR::HTTP_WebDAV_Server, but
so far I'm having little success.
All I could get from the 11 Slides was that the Class had to be subclassed,
and the methods overloaded, to provide the functionality.
I gathered from the source-code, that I had to instigate the object, and
call the ServeRequest method - This works OK for GET requests via the
Browser, but when I try it in MSWord or OOo, it opens whatever it marked
read only, as opposed to read/write.
I've written the following so far in an attempt to help me understand the
procedure. Any suggestions?
#!/usr/local/php51/bin/php
<?php
include_once("HTTP/WebDAV/Server.php");
function wlog($msg){
$logfile = "/tmp/webdav.log";
$fp = fopen($logfile, "a");
fwrite($fp, $msg . "\n");
fclose($fp);
}
class My_DAV_Server extends HTTP_WebDAV_Server {
function GET(&$p){
wlog("GET: $_SERVER[REQUEST_URI]");
// for some reason the $_SERVER['PATH_INFO'] is empty....
$path_info = substr($_SERVER['REQUEST_URI'],
strlen($_SERVER['SCRIPT_NAME']));
$str = "You called: $path_info";
header("Content-Type: text/plain");
header("Last-Modified: " . date("D, j M Y H:m:s ") . "GMT");
header("Content-Length: " . strlen($str));
echo $str;
return true;
}
function PUT(&$p){
wlog("PUT: $_SERVER[REQUEST_URI]");
}
function PROPFIND(&$p){}
/*
function COPY(&$p){}
function MOVE(&$p){}
function DELETE(&$p){}
function PROPPATCH(&$p){}
function LOCK(&$p){}
function UNLOCK(&$p){}
function CHECKLOCK(&$p){}
*/
}
$s = new My_DAV_Server();
$s->ServeRequest();