W3C home > Mailing lists > Public > w3c-dist-auth@w3.org > October to December 2001

FW: [Moderator Action] Webdav and php

From: Jim Whitehead <ejw@cse.ucsc.edu>
Date: Tue, 20 Nov 2001 09:33:30 -0800
To: "WebDAV" <w3c-dist-auth@w3.org>, <dav-dev@lyra.org>
Accidentally caught by the spam filter. I'm also cc'ing the dav-dev mailing

- Jim
-----Original Message-----
From: Michael Lam [mailto:mlam@tedis.com.au]
Sent: Monday, November 19, 2001 8:22 PM
To: w3c-dist-auth@w3.org
Subject: [Moderator Action] Webdav and php


I am not sure if this is the right place for me to ask the following
question, but I've decided to give it a try.

Currently I am trying to use php for the webdav properties. I have set up
apache in my local computer and php. The MKCOL and DELETE properties works
fine. But I am having problem getting the PROPPATCH and PROFIND property to
work in php. I have obtained a VB script and all the properties works fine
with the VB script (thus, it create a new resource, set properties, remove
properties, find the properties and delete resources).

The following is the code I have written in php...


$socket = fsockopen ("", 80);

if ($socket < 0) {
    echo "socket() failed: reason: " . "\n";
} else {
    "socket() successful: " . "\n";

   /* PROPATCH - */
   /* set or remove properties defined */
 $r = htmlentities("<?xml version=1.0 encoding=utf-8 ?>");
 $r .= htmlentities("<D:propertyupdate xmlns:D='DAV:'
 $r .= htmlentities("<D:set>");
 $r .= htmlentities("<D:prop>");
 $r .= htmlentities("<Z:Order>");
 $r .= htmlentities("<Z:Type>ORDER</Z:Type>");
 $r .= htmlentities("<Z:Status>OK</Z:Status>");
 $r .= htmlentities("</Z:Order>");
 $r .= htmlentities("</D:prop>");
 $r .= htmlentities("</D:set>");
 $r .= htmlentities("</D:propertyupdate>");
 $in = "PROPPATCH /webdisc/xyz.txt / HTTP/1.1\r\n";
 $in .= "Host: localhost\r\n";
 $in .= "Content-Type: text/plain\r\n";
 $in .= "Content-Length: ". strlen($r) ."\r\n";
 $in .= $r."\r\n";

   /* PROPFIND */
  /*$r = htmlentities("<?xml version=1.0 encoding=utf-8 ?>");
  $r .= htmlentities("<D:propfind xmlns:D='DAV:'>");
  $r .= htmlentities("<D:allprop/>");
  $r .= htmlentities("</D:propfind>");
  $in = "PROPFIND /webdisc/xyz.txt / HTTP/1.1\r\n";
  $in .= "Host: localhost\r\n";
  $in .= "Content-Type: text/plain\r\n";
  $in .= "Content-Length: \r\n";
  $in .= $r."\r\n";*/

$out = '';

fputs($socket, $in."\r\n");

while (!feof($socket)) {
 $out .= fread($socket, 4096);

fclose ($socket);


when I send the request with PROPPATCH property in php, it does not return
me anything.

When I use the VB script to set the property for a resource and then try to
use php to send a PROPFIND, it return me the followings but without the xml
containing the result I requested.

TCP/IP Connection
Attempting to connect to '' on port 80...

Request = PROPFIND /webdisc/xyz.txt / HTTP/1.1 Host: localhost Content-Type:
text/plain Content-Length: <?xml version=1.0 encoding=utf-8 ?><D:propfind
nd> Sending HTTP HEAD request...

Reading response:
HTTP/1.1 207 Multi-Status Date: Tue, 20 Nov 2001 03:38:40 GMT Server:
Apache/1.3.22 (Win32) DAV/1.0.3-dev Connection: close Content-Type:
text/xml; charset="utf-8" /webdisc/xyz.txt Order 1234 New
2001-11-15T06:25:51Z 5599 Tue, 20 Nov 2001 02:58:02 GMT "0-15df-3bf9c6ba"
text/plain HTTP/1.1 200 OK Closing socket...OK.

thank you for your help.

Received on Tuesday, 20 November 2001 12:33:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:01:24 UTC