1CURLOPT_POSTFIELDSIZE(3)   curl_easy_setopt options   CURLOPT_POSTFIELDSIZE(3)
2
3
4

NAME

6       CURLOPT_POSTFIELDSIZE - size of POST data pointed to
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_POSTFIELDSIZE,  long
12       size);
13

DESCRIPTION

15       If you want to post data to the server  without  having  libcurl  do  a
16       strlen()  to measure the data size, this option must be used. When this
17       option is used you can post  fully  binary  data,  which  otherwise  is
18       likely  to  fail.  If  this  size  is  set  to -1, the library will use
19       strlen() to get the size.
20
21       If you post more than 2GB, use CURLOPT_POSTFIELDSIZE_LARGE(3).
22

DEFAULT

24       -1
25

PROTOCOLS

27       HTTP
28

EXAMPLE

30       CURL *curl = curl_easy_init();
31       if(curl) {
32         const char *data = "data to send";
33
34         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
35
36         /* size of the POST data */
37         curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data));
38
39         curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
40
41         curl_easy_perform(curl);
42       }
43

AVAILABILITY

45       Along with HTTP
46

RETURN VALUE

48       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
49

SEE ALSO

51       CURLOPT_POSTFIELDS(3), CURLOPT_POSTFIELDSIZE_LARGE(3),
52
53
54
55libcurl 7.71.1                  March 23, 2020        CURLOPT_POSTFIELDSIZE(3)
Impressum