tonelm54
asked on
simple webdav server
I have a need to allow users to copy some file and so Ive been looking at using webdav, however I want to do it the good old fasioned way and do it myself (not use pre-built classes).
However after reading up on the protocol, all I need to do is return an XML file with the files (GET and PUT later) which uses function PROPFIND and returns a list of files with their properties, with the HTTP header return of 207 :-
http://blog.coralbits.com/ 2011/07/we bdav-proto col-for-du mmies.html ?m=1
So, sounds simple yes??? Well no, I cant get it working.
Just for starters I decided just to return the PROPFIND (no authentication, not workings, just a test), so I wrote the following:-
Fired up my webdav client and pointed it to http://localhost:8000/ and get 'connection refused'.
My issue is that the script should be dumping out the contents to 'input.txt', in a standard browser works fine and I get the export however in the webdav client it doesnt.
Can anyone advise me in this? Or if anyone has any experience in this it would be gratefully appreciated.
Thank you
However after reading up on the protocol, all I need to do is return an XML file with the files (GET and PUT later) which uses function PROPFIND and returns a list of files with their properties, with the HTTP header return of 207 :-
http://blog.coralbits.com/
So, sounds simple yes??? Well no, I cant get it working.
Just for starters I decided just to return the PROPFIND (no authentication, not workings, just a test), so I wrote the following:-
<?php
header("HTTP/1.1 207 OK");
$inputStr = file_get_contents("php://input");
file_put_contents("input.txt", $inputStr);
?>
<D:multistatus xmlns:D="DAV:">
<D:response xmlns:lp1="DAV:" xmlns:g0="DAV:">
<D:href>/CMakeFiles</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype>
<D:collection/>
</lp1:resourcetype>
<lp1:getlastmodified>Mon, 25 Jul 2011 08:49:40 GMT</lp1:getlastmodified>
<lp1:creationdate>2011-07-25T08:49:40Z</lp1:creationdate>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
Fired up my webdav client and pointed it to http://localhost:8000/ and get 'connection refused'.
My issue is that the script should be dumping out the contents to 'input.txt', in a standard browser works fine and I get the export however in the webdav client it doesnt.
Can anyone advise me in this? Or if anyone has any experience in this it would be gratefully appreciated.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.