xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. |
| 2 | SPDX-License-Identifier: curl |
| 3 | Long: data-urlencode |
| 4 | Arg: <data> |
| 5 | Help: HTTP POST data URL encoded |
| 6 | Protocols: HTTP |
| 7 | See-also: data data-raw |
| 8 | Added: 7.18.0 |
| 9 | Category: http post upload |
| 10 | Example: --data-urlencode name=val $URL |
| 11 | Example: --data-urlencode =encodethis $URL |
| 12 | Example: --data-urlencode name@file $URL |
| 13 | Example: --data-urlencode @fileonly $URL |
| 14 | Multi: append |
| 15 | --- |
| 16 | This posts data, similar to the other --data options with the exception |
| 17 | that this performs URL-encoding. |
| 18 | |
| 19 | To be CGI-compliant, the <data> part should begin with a *name* followed |
| 20 | by a separator and a content specification. The <data> part can be passed to |
| 21 | curl using one of the following syntaxes: |
| 22 | .RS |
| 23 | .IP "content" |
| 24 | This will make curl URL-encode the content and pass that on. Just be careful |
| 25 | so that the content does not contain any = or @ symbols, as that will then make |
| 26 | the syntax match one of the other cases below! |
| 27 | .IP "=content" |
| 28 | This will make curl URL-encode the content and pass that on. The preceding = |
| 29 | symbol is not included in the data. |
| 30 | .IP "name=content" |
| 31 | This will make curl URL-encode the content part and pass that on. Note that |
| 32 | the name part is expected to be URL-encoded already. |
| 33 | .IP "@filename" |
| 34 | This will make curl load data from the given file (including any newlines), |
| 35 | URL-encode that data and pass it on in the POST. |
| 36 | .IP "name@filename" |
| 37 | This will make curl load data from the given file (including any newlines), |
| 38 | URL-encode that data and pass it on in the POST. The name part gets an equal |
| 39 | sign appended, resulting in *name=urlencoded-file-content*. Note that the |
| 40 | name is expected to be URL-encoded already. |
| 41 | .RE |