首页 > 解决方案 > 使用 CURL 重定向后发送表单数据

问题描述

我正在使用 curl 发送文件:

curl https://localhost/input.php --insecure -L --form "id=myId" --form "file[]=@/tmp/myFile"

只要我正在编写 http (并且不执行重定向),这一切正常。当我编写 时http://localhost/input.php Webserver 使用 302 重定向到 https 站点。curl跟随该链接,但curl不会将表单数据“重新发送”到目标。

即使在 302 重定向之后,我如何告诉 curl 重新发送 FORM 数据?

标签: curl

解决方案


自己找到了答案:

 --post302

https://curl.haxx.se/docs/manpage.html#--post302


推荐阅读