Curl FTP访问被拒绝
我正在使用curlpphpapi访问FTP链接。在特定站点上,它给出错误代码9(拒绝访问)。但是,可以从IE和Firefox访问该链接 然后我运行curl命令行,它给出了相同的“accessdeinied”结果Curl FTP访问被拒绝,curl,libcurl,Curl,Libcurl,我正在使用curlpphpapi访问FTP链接。在特定站点上,它给出错误代码9(拒绝访问)。但是,可以从IE和Firefox访问该链接 然后我运行curl命令行,它给出了相同的“accessdeinied”结果 >d:>\curl-vftp://ftp1.example.com/outgoing/EHF/dbex10win_en.zip >*即将连接()到ftp1.example.com端口21(#0) >*尝试204.50.113.145。。。 >*连接 >*连接到ftp1.example.c
>d:>\curl-vftp://ftp1.example.com/outgoing/EHF/dbex10win_en.zip
>*即将连接()到ftp1.example.com端口21(#0)
>*尝试204.50.113.145。。。
>*连接
>*连接到ftp1.example.com(204.50.113.145)端口21(#0)<220 Microsoft FTP服务
>>用户匿名<331允许匿名访问,将身份(电子邮件名称)作为密码发送。
>>通过ftp@example.com<230欢迎使用示例FTP站点!<230匿名用户登录。
>>PWD<257“/”是当前目录。
>*入口路径为“/”
>>CWD传出<550传出:访问被拒绝。
>*服务器拒绝您更改到给定目录
>*与主机ftp1.example.com的连接#0保持完整:(9)服务器拒绝您更改到给定目录
>>退出<221
>*关闭连接#0
但是这个链接在Firefox中运行良好。卷曲有什么问题吗?谢谢这与
CURL
无关。错误非常明显服务器拒绝您更改给定目录
。。。这只是一个访问问题
添加用户名
和密码
可以简单地解决这个问题
为什么它在浏览器上工作。。。没有自动目录重定向。。为什么它对卷曲不起作用???curl将使用标准的ftp
过程,这将涉及在您更改到相关目录之前登录
您可以通过php直接使用它fopen
或file\u get\u content
是我使用的一种欺骗。。。就像您的用户正在通过浏览器访问它一样工作
范例
set_time_limit(0);
file_put_contents("out.zip", file_get_contents('ftp://204.50.113.145/outgoing/EHF/dbex10win_en.zip'));
像charm一样工作尝试摆弄curl的选项——ftp方法
这意味着远程/ftp服务器中不存在指定的目录,因此会显示消息“服务器拒绝您更改到给定目录” 该消息与您试图将文件下载到的本地计算机无关
登录到
ftp datacenter.myserver.com
并查看源目录是否存在。如果指定目录的完整路径,是否会产生影响?在哪里使用libcurl?!?
set_time_limit(0);
file_put_contents("out.zip", file_get_contents('ftp://204.50.113.145/outgoing/EHF/dbex10win_en.zip'));
--ftp-method [method]
(FTP) Control what method curl should use to reach a file on a
FTP(S) server. The method argument should be one of the follow‐
ing alternatives:
multicwd
curl does a single CWD operation for each path part in
the given URL. For deep hierarchies this means very many
commands. This is how RFC 1738 says it should be done.
This is the default but the slowest behavior.
nocwd curl does no CWD at all. curl will do SIZE, RETR, STOR
etc and give a full path to the server for all these
commands. This is the fastest behavior.
singlecwd
curl does one CWD with the full target directory and
then operates on the file "normally" (like in the multi‐
cwd case). This is somewhat more standards compliant
than 'nocwd' but without the full penalty of 'multicwd'.