data.d 1.5 KB

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