Shell 编程用CURL 模拟POST 上传文件 解决417 Expectation

来源:互联网 发布:ssm 打印sql 编辑:程序博客网 时间:2024/04/29 02:12

话不多说直接抛代码

curl -H "Expect:" -F "passport=monitor_134" -F "data=@/root/monitor/result/mid_1_rule_1.txt" http://192.168.1.207:80/monitor2.006/collect/receiveShellResultFile.php > /root/monitor/log/post.log

  上面的代码 稍微解释一下:

第一个参数             -H “Expect” 用来解决在lighttpd 下 " 417 - Expectation Failed "

第二、三个参数       -F 就是你上传表单里的字段 其中 @后面表示要上传的本地文件路径

PHP 接收端就不用我贴了吧 ,如果你不会那是你自己的问题了。。。。

试试吧