data-urlencode.md (1600B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Long: data-urlencode 5 Arg: <data> 6 Help: HTTP POST data URL encoded 7 Protocols: HTTP 8 Added: 7.18.0 9 Category: http post upload 10 Multi: append 11 See-also: 12 - data 13 - data-raw 14 Example: 15 - --data-urlencode name=val $URL 16 - --data-urlencode =encodethis $URL 17 - --data-urlencode name@file $URL 18 - --data-urlencode @fileonly $URL 19 --- 20 21 # `--data-urlencode` 22 23 Post data, similar to the other --data options with the exception that this 24 performs URL-encoding. 25 26 To be CGI-compliant, the \<data\> part should begin with a *name* followed by 27 a separator and a content specification. The \<data\> part can be passed to 28 curl using one of the following syntaxes: 29 30 ## content 31 URL-encode the content and pass that on. Just be careful so that the content 32 does not contain any `=` or `@` symbols, as that makes the syntax match one of 33 the other cases below. 34 35 ## =content 36 URL-encode the content and pass that on. The preceding `=` symbol is not 37 included in the data. 38 39 ## name=content 40 URL-encode the content part and pass that on. Note that the name part is 41 expected to be URL-encoded already. 42 43 ## @filename 44 load data from the given file (including any newlines), URL-encode that data 45 and pass it on in the POST. Using `@-` makes curl read the data from stdin. 46 47 ## name@filename 48 load data from the given file (including any newlines), URL-encode that data 49 and pass it on in the POST. The name part gets an equal sign appended, 50 resulting in *name=urlencoded-file-content*. Note that the name is expected to 51 be URL-encoded already.