$ crul https://example.com
# レスポンスヘッダを表示
$ curl -i https://example.com
# レスポンスヘッダのみ表示
$ curl --head https://example.com
// or
$ curl -I $ crul https://example.com
# 進捗を表示しない
$ curl -s https://example.com
# ファイルへ保存
$ curl -o /path/to/file https://example.com
# SSLの警告を無視
$ curl -k https://example.com
| オプション | 内容 | 
|---|---|
| X | メソッドを指定 | 
| H | ヘッダを指定 | 
| d | POSTのボディを application/x-www-form-urlencoded(MIME type)で送信-X POST -d 'key1=value1&key2=value2' | 
| d | POSTのボディを application/json(MIME type)で送信-X POST -H 'Content-Type:application/json;charset=UTF8' -d '{"key": "value", "key2": "value2"}' | 
| F | POSTのボディを multipart/form-data(MIME type)で送信-X POST -F 'key1=value1' | 
| I | HTTPヘッダのみ表示( --headと同じ) | 
| u | ユーザー名/パスワード指定 $ curl -u info@example.com:GxxxxxxxxxB https://example.com/login | 
| s | silentモード。進行状況を表示しません。 | 
| S | エラーを表示します。sオプションと合わせて使用したとき進行状況は表示せずエラーのみ表示します。 $ crul -sS http://www.example.com/api | 
| L | location. 3xxのとき転送先へリクエストを実行します。 | 
| k | SSLの警告を無視 | 
| w | https://zenn.dev/taxin/articles/curl-time-measure | 
ref. https://qiita.com/att55/items/04e8080d1c441837ad42
WordPress Rest APIをcurlとjqを使って表示する。
$ curl https://www.findxfine.com/wp-json/wp/v2/posts/995561945 | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3055  100  3055    0     0   7030      0 --:--:-- --:--:-- --:--:--  7039
{
  "id": 995561945,
  "date": "2018-09-29T17:29:21",
  "date_gmt": "2018-09-29T08:29:21",
  "guid": {
    "rendered": "https://www.findxfine.com/?p=995561945"
  },
  "modified": "2018-09-30T11:58:38",
  "modified_gmt": "2018-09-30T02:58:38",
  "slug": "php%e3%81%a7slack%e3%81%b8post-php",
  "status": "publish",
  "type": "post",
  "link": "https://www.findxfine.com/programming/php/995561945.html",
  "title": {
    "rendered": "PHPでSlackへPOST : PHP"
  },
  "content": {
    "rendered": "<p>PHPからSlackへ投稿するサンプルです。<br />\n<!--more--></p>\n<pre><code class=\"php\"><?php\n$url         = 'https://hooks.slack.com/services/xxxxxx/xxxxxx/xxxxxx';\n\n$payloadData = json_encode(['text' => 'Hello Slack:smile:']);\n$body     = [\n    'payload' => $payloadData,\n];\n\n$options = [\n    CURLOPT_URL            => $url,\n    CURLOPT_POST           => true,\n    CURLOPT_POSTFIELDS     => http_build_query($body),\n];\n\n$curl = curl_init();\ncurl_setopt_array($curl, $options);\ncurl_exec($curl);\ncurl_close($curl);\n</code></pre>\n<p><code>Ubuntu 18.04</code>の<code>apt</code>で公式リポジトリから入れた<code>PHP7.2</code>は、<code>cURL拡張モジュール</code>がインストールされていなかったので、インストールしました。</p>\n<pre><code class=\"shell\">$ sudo apt install php7.2-curl\n</code></pre>\n",
    "protected": false
  },
  "excerpt": {
    "rendered": "<p>PHPからSlackへ投稿するサンプルです。</p>\n",
    "protected": false
  },
  "author": 1,
  "featured_media": 0,
  "comment_status": "open",
  "ping_status": "closed",
  "sticky": false,
Basic 認証は情報とする
// インタラクティブにパスワードを入力
$ curl -u example -iL https://example.com
// パスワードを付与( u オプションが base64 エンコードするので、エンコード前のパスワードを渡す
$ curl -u 'example:password' -iL http://example.com