Curl 日常命令

参数列表
参数 含义 用法
-s 去掉进度条 curl 127.0.0.1:80 -s
-o 指定结果写入文件 curl 127.0.0.1:80 -o curl.txt
-d 指定参数 body curl 127.0.0.1:80 -d ‘foo=bar’
-H 指定请求头 curl 127.0.0.1:80 -H ‘Content-Type:application/json’
-X 指定请求方法 curl 127.0.0.1:80 -X POST -H -H ‘Content-Type:application/json’ -d ‘{“foo”:”bar”}’
-s
$ curl https://www.baidu.com -o baidu.txt
$ curl https://www.baidu.com -o baidu.txt -s
-o
$ curl https://www.baidu.com -o baidu.txt
$ ll baidu.txt
$ cat baidu.txt
-d
$ curl http://localhost:8888 -d "age=18"
-H
$ curl http://localhost:8888 -H "Content-Type:application/json"
$ curl http://localhost:8888 -H "foo:bar"
-X
curl http://localhost:8888\?name\=wl -H "Content-Type:application/json" -X POST  -d "{\"age\":24}"


linux     

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!