data.d 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  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. ---
  16. Sends the specified data in a POST request to the HTTP server, in the same way
  17. that a browser does when a user has filled in an HTML form and presses the
  18. submit button. This will cause curl to pass the data to the server using the
  19. content-type application/x-www-form-urlencoded. Compare to --form.
  20. --data-raw is almost the same but does not have a special interpretation of
  21. the @ character. To post data purely binary, you should instead use the
  22. --data-binary option. To URL-encode the value of a form field you may use
  23. --data-urlencode.
  24. If any of these options is used more than once on the same command line, the
  25. data pieces specified will be merged with a separating &-symbol. Thus, using
  26. \&'-d name=daniel -d skill=lousy' would generate a post chunk that looks like
  27. \&'name=daniel&skill=lousy'.
  28. If you start the data with the letter @, the rest should be a file name to
  29. read the data from, or - if you want curl to read the data from stdin. Posting
  30. data from a file named \&'foobar' would thus be done with --data @foobar. When
  31. --data is told to read from a file like that, carriage returns and newlines
  32. will be stripped out. If you do not want the @ character to have a special
  33. interpretation use --data-raw instead.