最終更新:2025-05-18 (日) 23:22:19 (428d)
curl
Top / curl
man
https://curl.se/docs/manpage.html
パラメータ 意味 -X {method} HTTPメソッド -H {headerText} header -G GET -d {requestBody} POST data,-GのときはGETのパラメータ -O, --remote-name 出力をローカルファイルへ書き込みます。 このときの出力ファイル名を,取得したリモートのファイルから得ることを指示します(リモートファイルの名前の部分のみが利用され、他の部分はパスから取り除かれます)。 -L, --location (HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option makes curl redo the request on the new place.
メモ
--data-binary @{path_to_file}
ダウンロード
curl -O <URI>
HTTPのメソッドを指定
GET
- -GがGETの指定で、-d は-Gと組み合わせると GETパラメータの指定になる
curl -X GET http://example.com curl -G -d 'message=Hello World' http://example.com
POST
- -d はPOST dataの指定
curl -X POST http://example.com curl -d 'message=Hello World' http://example.com
PUT?
curl -X PUT http://example.com/
DELETE?
curl -X DELETE http://example.com/

