【記一下】curl用法

1. 上傳文件(octet-stream)json

curl -XPUT \
--data-binary '@hello.txt' \
-H "Content-Type: application/octet-stream" \
-H "Date: Mon, 04 Sep 2017 03:29:57 GMT" \
http://hostname:port/foo/bar/hello.txt

2. 設置http代理bash

curl -x 'http://username:password@proxyhost:port' \
http://www.baidu.com/

3. server端basic認證app

curl -u kermit:kermit \
http://localhost:8080/flowable-rest/service/repository/process-definitions

4. 只獲取響應頭信息curl

curl -I \
http://www.baidu.com/

5. 關閉證書驗證url

curl -k \
https://some-self-signed-host.com/

or 代理

curl --insecure \
https://some-self-signed-host.com/

6. POST json請求rest

curl -X POST \
-H "Content-Type:application/json; charset=UTF-8" \
--data '{"a":"b"}' \
http://hostname:port/

7. POST 表單code

curl -X POST \
-F 'foo=bar' \
-F 'file=@/path/to/file.text' \
--trace-ascii - \
http://host:port/submit
相關文章
相關標籤/搜索