PHP iDisk\Webdav 客户端
我需要将文件上传到 iDisk 驱动器。我发现 iDisk 有 webdav 界面,并且它在桌面客户端上运行良好。不幸的是我无法找到合适的 PHP WebDav 客户端,也无法找到如何使用 cUrl 将文件上传到 WebDav。唯一的 客户端我发现 class 无法在我的主机上运行(我们正在使用共享的 GoDaddy 主机)。
谁能告诉我如何使用 PHP 将文件上传到 WebDav\iDisk 服务器?
提前致谢, Michael
UPD
对于那些正在寻找答案的人,这里有一个代码片段:
include("PEAR/HTTP/WebDAV/Client.php");
$client = new HTTP_WebDAV_Client_Stream();
$user="YOUR_LOGIN";
$pass = "YOUR_PASSWORD";
$dir = "webdav://".$user.":".$pass."@idisk.me.com/".$user."/";
$path = "";
var_dump($client->stream_open($dir."test.txt","w",null,$path));
$client->stream_write("HELLO WORLD!");
$client->stream_close();
$client->dir_opendir($dir,array());
var_dump($client->dirfiles);
I need to upload files to iDisk drive. I've found that iDisk has webdav interface, and it's working fine with desktop clients. Unfortunately I wasn't able to find suitable WebDav client for PHP, and can't find out how to use cUrl to upload files to WebDav. The only client class I've found doesn't run on my hosting (we are using shared GoDaddy hosting).
Can anyone tell me how can I upload files to WebDav\iDisk Server with PHP?
thanks in advance,
Michael
UPD
For those, who is searching for answer, here is a code snippet:
include("PEAR/HTTP/WebDAV/Client.php");
$client = new HTTP_WebDAV_Client_Stream();
$user="YOUR_LOGIN";
$pass = "YOUR_PASSWORD";
$dir = "webdav://".$user.":".$pass."@idisk.me.com/".$user."/";
$path = "";
var_dump($client->stream_open($dir."test.txt","w",null,$path));
$client->stream_write("HELLO WORLD!");
$client->stream_close();
$client->dir_opendir($dir,array());
var_dump($client->dirfiles);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以尝试 PEAR webdav 客户端?
http://pear.php.net/package/HTTP_WebDAV_Client/
祝你好运:)
Maybe you could try the PEAR webdav client?
http://pear.php.net/package/HTTP_WebDAV_Client/
Good luck :)