Solved

simple webdav server

Posted on 2014-11-25
1
95 Views
Last Modified: 2014-12-11
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/webdav-protocol-for-dummies.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:-
<?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>

Open in new window


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
0
Comment
Question by:tonelm54
1 Comment
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40465257
Unless you have a 'listener' or 'Virtual Host' on port 8000, that will be the normal response.  Have you read the Apache docs on WebDAV?  http://httpd.apache.org/docs/2.2/mod/mod_dav.html
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question