data.d 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  2. SPDX-License-Identifier: curl
  3. Long: data
  4. Short: d
  5. Arg: <data>
  6. Help: HTTP POST data
  7. Protocols: HTTP MQTT
  8. See-also: data-binary data-urlencode data-raw
  9. Mutexed: form head upload-file
  10. Category: important http post upload
  11. Example: -d "name=curl" $URL
  12. Example: -d "name=curl" -d "tool=cmdline" $URL
  13. Example: -d @filename $URL
  14. Added: 4.0
  15. Multi: append
  16. ---
  17. Sends the specified data in a POST request to the HTTP server, in the same way
  18. that a browser does when a user has filled in an HTML form and presses the
  19. submit button. This will cause curl to pass the data to the server using the
  20. content-type application/x-www-form-urlencoded. Compare to --form.
  21. --data-raw is almost the same but does not have a special interpretation of
  22. the @ character. To post data purely binary, you should instead use the
  23. --data-binary option. To URL-encode the value of a form field you may use
  24. --data-urlencode.
  25. If any of these options is used more than once on the same command line, the
  26. data pieces specified will be merged with a separating &-symbol. Thus, using
  27. '-d name=daniel -d skill=lousy' would generate a post chunk that looks like
  28. 'name=daniel&skill=lousy'.
  29. If you start the data with the letter @, the rest should be a file name to
  30. read the data from, or - if you want curl to read the data from stdin. Posting
  31. data from a file named 'foobar' would thus be done with --data @foobar. When
  32. --data is told to read from a file like that, carriage returns and newlines
  33. will be stripped out. If you do not want the @ character to have a special
  34. interpretation use --data-raw instead.