概要 †
サンプル †
参考資料 †
インストール †
- apt-get install libcurl4-gnutls-dev
-d, -F の違い †
https://qiita.com/att55/items/04e8080d1c441837ad42
- d (--data) と -F (--Form)
curl -X POST -d
curl の POST オプションを -d (--data) とした場合、MIME type は application/x-www-form-urlencoded になります。
curl -X POST -d ‘name=taro’
curl -X POST -F
続いて -F (--Form) オプションを使う場合、MIME type は multipart/form-data になります。
curl -X POST -F ‘name=taro’
これら2つの MIME type が使われるシーンは主に HTML フォーム <form> を使う時です。
form enctype="application/x-www-form-urlencoded"/>
form enctype="multipart/form-data"/>
では、違いは何でしょうか?
https://davidwalsh.name/curl-post-file
POSTing Files with cURL
POSTing a file with cURL is slightly different in that you need to add an @ before the file location, after the field name:
curl -X POST -F 'image=@/path/to/pictures/picture.jpg' http://domain.tld/upload