curl -d

    -d/--data <data>
              (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and  presses
              the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded.  Compare to -F/--form.

              -d/--data  is  the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode the value of a form field
              you may use --data-urlencode.

              If any of these options is used more than once on the same command line, the data pieces specified will be merged together with a separating &-symbol.  Thus,
              using ’-d name=daniel -d skill=lousy’ would generate a post chunk that looks like ’name=daniel&skill=lousy’.

              If  you  start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin.  The con-
              tents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named ’foobar’ would thus be done  with  --data
              @foobar.


 (HTTP) 发送指定的数据以一个POST 请求到HTTP server,

与用户填写一个HTML表单然后按下submit 按钮一样。

这个会导致CURL 传递数据到服务器使用 content-type application/x-www-form-urlencoded.  


-d/--data 是一样的和--data-ascii。 如果要请求二进制数据,你应该使用--data-binary option. 


URL-encode 表单字段的值 


如果那些选项是被使用多次在相同的命令行, 数据段会被合并使用一个分割符号&

因此使用 ’-d name=daniel -d skill=lousy’  会生成一个post chunk 看起来像
 ’name=daniel&skill=lousy’.

原文地址:https://www.cnblogs.com/hzcya1995/p/13349582.html