【发布时间】:2015-10-25 23:16:40
【问题描述】:
我正在尝试向 ProFTPD 服务器发送一些标准命令,而 curl 总是发送 LIST 命令,而我的命令结果被 LIST 响应覆盖。
curl_setopt($curl, CURLOPT_URL, "ftp://domain.xyz:21");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_QUOTE, array('PWD'));
$result=curl_exec($curl);
日志文件包含:
> PWD
< 257 "/" is the current directory
> PASV
* Connect data stream passively
< 227 Entering Passive Mode (xxx,xxx,xxx,xxx,xxx,xxx).
* Hostname was NOT found in DNS cache
* Trying xxx.xxx.xxx.xxx...
* Connecting to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 39794
* Connected to xyz (xxx.xxx.xxx.xxx) port 21 (#0)
> TYPE A
< 200 Type set to A
> LIST
< 150 Opening ASCII mode data connection for file list
我想得到“257”/“是当前目录”这一行。
更新:
有一个选项CURLOPT_NOBODY,它会停用LIST 命令,但我仍然无法得到PWD 命令的响应,即使使用CURLOPT_CUSTOMREQUEST。
我不能使用 PHP 的 FTP 命令,因为 Windows 上的 PHP 没有 ftp_ssl_connect 功能。是否有任何其他支持 TLS 和上传/下载进度处理程序的 FTP 库?
【问题讨论】: