lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | Long: data |
| 2 | Short: d |
| 3 | Arg: <data> |
| 4 | Help: HTTP POST data |
| 5 | Protocols: HTTP |
| 6 | See-also: data-binary data-urlencode data-raw |
| 7 | Mutexed: form head upload |
| 8 | --- |
| 9 | Sends the specified data in a POST request to the HTTP server, in the same way |
| 10 | that a browser does when a user has filled in an HTML form and presses the |
| 11 | submit button. This will cause curl to pass the data to the server using the |
| 12 | content-type application/x-www-form-urlencoded. Compare to --form. |
| 13 | |
| 14 | --data-raw is almost the same but does not have a special interpretation of |
| 15 | the @ character. To post data purely binary, you should instead use the |
| 16 | --data-binary option. To URL-encode the value of a form field you may use |
| 17 | --data-urlencode. |
| 18 | |
| 19 | If any of these options is used more than once on the same command line, the |
| 20 | data pieces specified will be merged together with a separating |
| 21 | &-symbol. Thus, using '-d name=daniel -d skill=lousy' would generate a post |
| 22 | chunk that looks like \&'name=daniel&skill=lousy'. |
| 23 | |
| 24 | If you start the data with the letter @, the rest should be a file name to |
| 25 | read the data from, or - if you want curl to read the data from |
| 26 | stdin. Multiple files can also be specified. Posting data from a file named |
| 27 | 'foobar' would thus be done with --data @foobar. When --data is told to read |
| 28 | from a file like that, carriage returns and newlines will be stripped out. If |
| 29 | you don't want the @ character to have a special interpretation use --data-raw |
| 30 | instead. |