gpt4 book ai didi

curl - curl FTP访问被拒绝

转载 作者:行者123 更新时间:2023-12-05 01:29:37 29 4
gpt4 key购买 nike

我正在使用curl php API访问FTP链接。在特定站点上,它给出错误代码9(拒绝访问)。但是,可以从IE和Firefox访问该链接。

然后,我运行curl命令行,它给出了相同的“访问拒绝”结果。

> d:>\curl -v ftp://ftp1.example.com/outgoing/EHF/dbex10win_en.zip
> * About to connect() to ftp1.example.com port 21 (#0)
> * Trying 204.50.113.145...
> * connected
> * Connected to ftp1.example.com (204.50.113.145) port 21 (#0) < 220 Microsoft FTP Service
> > USER anonymous < 331 Anonymous access allowed, send identity (e-mail name) as password.
> > PASS ftp@example.com < 230-Welcome to Example FTP site! < 230 Anonymous user logged in.
> > PWD < 257 "/" is current directory.
> * Entry path is '/'
> > CWD outgoing < 550 outgoing: Access is denied.
> * Server denied you to change to the given directory
> * Connection #0 to host ftp1.example.com left intact curl: (9) Server denied you to change to the given directory
> > QUIT < 221
> * Closing connection #0


但是该链接在Firefox中可以正常工作。这里的cUrl有什么问题?谢谢

最佳答案

尝试摆弄curl的选项--ftp-method


   --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'.

关于curl - curl FTP访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10093432/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com