使用 PHP 连接到 WebDAV?
我想使用 PHP 连接到 WebDAV,并能够上传文件等。但是,我不知道如何连接到它。我想它最终会像打开套接字并发送正确的标头/命令一样简单,但我不知道需要发送什么。我想在没有额外的库/类的情况下做到这一点。
有人能指出我正确的方向吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以像任何其他 HTTP 服务器一样连接到 WebDAV 服务器,但您必须使用 WebDAV。
但是,由于 HTTP 和 WebDAV 之间存在足够的差异,您需要自己处理,因此最好使用 WebDAV 客户端或库。
WebDAV 是带有附加动词的扩展 HTTP 术语如 PROPFIND、PROPPATCH、REPORT 等。它还支持使用 xml 负载通过 PROPFIND 和 PROPPATCH 查询、设置和获取 webdav 资源的元属性。虽然很多方面应该与 HTTP 概念类似。它与 HTTP 有许多不同的小变化/细微差别。
上面对 WebDAV 的简要介绍可能有点误导,因此请阅读 WebDAV RFC 和信息 上的详细信息。
请参阅以下典型客户端实现:
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.
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: