curl 常用命令

2020-10-14 09:42:05 20795

# -v 参数输出通信的整个过程,用于调试

curl -v -I  http://www.landui.com

# -x 指定http代理访问

curl -I www.landui.com -x 127.0.0.1:80

# -e 参数用来设置 HTTP 的标头Referer

curl -I  https://www.landui.com  -e "http://www.landui.com/"

# -A 设置user-agent

curl -I https://www.landui.com -A "Baiduspider"

# -L 参数会让 HTTP 请求跟随服务器的重定向。curl默认不跟随重定向

curl -L -I  http://www.landui.com

# -k 参数指定跳过SSL检测,不会检查服务器的SSL证书是否正确

curl -k  http://www.landui.com

# --limit-rate用来限制 HTTP 请求和回应的带宽,模拟慢网速的环境

curl --limit-rate 200k  http://www.landui.com

# -s 参数将不输出错误和进度信息。

curl -s https://www.landui.com

#-S 参数指定只输出错误信息,通常与-s一起使用。

curl -S -s -o /dev/null  http://www.landui.com

# -R :Set the remote file's time on the local output

curl -OR  http://www.landui.com/1.html

# -X 参数指定 HTTP 请求的方法

curl -X POST  http://www.landui.com

# 不需要修改/etc/hosts,curl直接解析ip请求域名

curl --resolve www.landui.com:80:127.0.0.1 http://www.landui.com/

curl --resolve www.landui.com:443:127.0.0.1 https://www.landui.com/


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: