LoginSignup
13
8

More than 5 years have passed since last update.

POST binary data by "curl" command

Posted at
$ cat <binary_file> | curl --data-binary @- <url>

curlでPOSTリクエストを送る際のオプション-d(--data)は--data-asciiという扱い。その他にも--data-binary--data-urlencodeといったオプションが指定できる。
引数が@で始まる場合、残りの文字列はファイル名を指すことになり、それが-の場合は標準入力から読み込む、ということになる。従って--data @-は標準入力から読んだデータを使ってPOSTする、ということになる。

13
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
8