curl的常用命令

apt install curl
curl www.baidu.com

curl 命令行浏览器式的浏览器

参数说明示例
-a设置user-agentcurl -a “Chrome” https://www.baidu.com
-X用制定方法请求curl -X post http://httpbin.org/post
-I只返回请求的头信息curl -I http://baidu.com
-d以post方法请求URL,并发送相应的参数curl -d test=123 http://httpbin.org/post curl -d “a=1&b=2&c=3” http://httpbin.org/post curl -d a=1 -d b=2 -d c=3 http://httpbin.org/post 也可以使用文件写入
-O下载文件并以远程的文件名保存curl -O http://httpbin.org/image/jpeg
-o下载文件设置自己的名字保存curl -o fox.jpeg http://httpbin.org/image/jpeg
-L跟随重定向请求curl -IL https://baidu.com
-H设置头信息
-k允许发起不安全的SSL请求curl -Lk https://www.12306.cn
-b设置cookiescurl -b a=test http://httpbin.org/cookies
posted @ 2021-05-05 16:15  Zeker62  阅读(50)  评论(0编辑  收藏  举报