1CURLOPT_HTTPPOST(3)                 libcurl                CURLOPT_HTTPPOST(3)
2
3
4

NAME

6       CURLOPT_HTTPPOST - multipart formpost content
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
12                                 struct curl_httppost *formpost);
13

DESCRIPTION

15       This option is deprecated. Use CURLOPT_MIMEPOST(3) instead.
16
17       Tells  libcurl  you  want a multipart/formdata HTTP POST to be made and
18       you instruct what data to pass on to the server in the  formpost  argu‐
19       ment.   Pass a pointer to a linked list of curl_httppost structs as pa‐
20       rameter.  The easiest way to create such a list, is  to  use  curl_for‐
21       madd(3) as documented. The data in this list must remain intact as long
22       as the curl transfer is alive and is using it.
23
24       Using POST with HTTP 1.1 implies the use of  a  "Expect:  100-continue"
25       header.  You can disable this header with CURLOPT_HTTPHEADER(3).
26
27       When setting CURLOPT_HTTPPOST(3), it will automatically set CURLOPT_NO‐
28       BODY(3) to 0.
29

DEFAULT

31       NULL
32

PROTOCOLS

34       HTTP
35

EXAMPLE

37       /* Fill in the file upload field. This makes libcurl load data from
38          the given file name when curl_easy_perform() is called. */
39       curl_formadd(&formpost,
40                    &lastptr,
41                    CURLFORM_COPYNAME, "sendfile",
42                    CURLFORM_FILE, "postit2.c",
43                    CURLFORM_END);
44
45       /* Fill in the filename field */
46       curl_formadd(&formpost,
47                    &lastptr,
48                    CURLFORM_COPYNAME, "filename",
49                    CURLFORM_COPYCONTENTS, "postit2.c",
50                    CURLFORM_END);
51
52       /* Fill in the submit field too, even if this is rarely needed */
53       curl_formadd(&formpost,
54                    &lastptr,
55                    CURLFORM_COPYNAME, "submit",
56                    CURLFORM_COPYCONTENTS, "send",
57                    CURLFORM_END);
58

AVAILABILITY

60       As long as HTTP is enabled. Deprecated in 7.56.0.
61

RETURN VALUE

63       Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
64

SEE ALSO

66       CURLOPT_POSTFIELDS(3), CURLOPT_POST(3), CURLOPT_MIMEPOST(3),  curl_for‐
67       madd(3), curl_formfree(3), curl_mime_init(3)
68
69
70
71ibcurl 8.2.1                    April 26, 2023             CURLOPT_HTTPPOST(3)
Impressum