data.d 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. c: Copyright (C) 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 makes curl 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 are 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. are stripped out. If you do not want the @ character to have a special
  34. interpretation use --data-raw instead.
  35. The data for this option is passed on to the server exactly as provided on the
  36. command line. curl does not convert, change or improve it. It is up to the
  37. user to provide the data in the correct form.