Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to WebDAV with PHP?

I'd like to connect to WebDAV using PHP, and be able to upload files, etc. However, I cannot figure out how to connect to it. I imagine it would ultimately be as simple as opening a socket and sending the proper headers/commands, but I don't know what I'd need to send. I'd like to do this without extra libraries/classes.

Can anyone point me in the right direction?

like image 906
Rob Avatar asked Nov 16 '10 00:11

Rob


1 Answers

Yes, you would connect to a WebDAV server like any other HTTP server but you will have to talk WebDAV.

But, since there are enough difference between HTTP and WebDAV that you need to handle yourself, you are better off using a WebDAV client or a library.

  • http://sabre.io/dav/davclient/

WebDAV is an extended HTTP lingo with additional verbs like PROPFIND, PROPPATCH, REPORT etc. It also provides support for querying, setting and fetching meta-properties of a webdav resource via the PROPFIND and PROPPATCH using xml payload. While many aspects should be similar to HTTP notions. There are a number of small changes / nuances where it differs from HTTP.

This above brief introduction to WebDAV can be a bit misleading so read the details on WebDAV RFC and Info.

See the following as a typical client implementation:

  • PHP iDisk\Webdav Client
like image 69
pyfunc Avatar answered Sep 19 '22 12:09

pyfunc