curl
curl man page
curlコマンド忘れるので最低限、使ったことあるオプションはメモ
-d
--data-binary @-
-fLo
vimのプラグインをDLする時に見た
-L
リダイレクト先があればそっちを見に行く
-H
ヘッダ
-i
-I
ヘッダだけ取得
-O
ファイルに出力
デフォルトは標準出力
curl URL > output.txtでもいい
-u
-X
HTTPメソッド指定
code:sh
curl http://weather.livedoor.com/forecast/webservice/json/v1?city=130010 | jq ".forecasts1.temperature"
curl -u ACCOUNT:PASSWORD \
-d '{"title":TITLE, "key":KEY}' \
https://api.github.com/user/keys
curl -X DELETE URL
curl -H "Header: hogehoge" \
-d "data=hoge&data2=hoge2" http://google.com
curl -X POST
-i \
-H 'Authorization: Basic XXXXXXXXXXXXXXX' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d "clientId=CCCCC" \
-d "grant_type=authorization_code" \
-d "redirect_uri=http%3A%2F%2Flocalhost%3A4000%2Fauth" \
-d "code=CCCCCCCCCCCCCCCCCCCCCCCCCC" https://api.fitbit.com/oauth2/token
curl -fLo ~/.vim/autoload/plug.vim \
--create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -O https://raw.githubusercontent.com/mattn/go-vue-example/master/static/style.css
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \
-d "body=date '+%Y-%m-%d-%H:%M:%S.%N'" URL
echo "pushgateway_sample" | curl --data-binary @- URL
curl -X DELETE URL
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \
-d "body=hoge" URL
code:curl.sh
curl -O http://gosyujin.com/index.html
参考
curl - How To Use
よく使うcurlコマンドのオプション - Qiita
Curl で時間計測 | | 1Q77
curlのオプション勉強したのでまとめ - うまいぼうぶろぐ
逆引きcurlコマンドのオプション一覧 | 瀬戸内の雲のように