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

NAME

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

DEFAULT

32       NULL
33

PROTOCOLS

35       HTTP
36

EXAMPLE

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

AVAILABILITY

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

RETURN VALUE

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

SEE ALSO

67       CURLOPT_POSTFIELDS(3),  CURLOPT_POST(3), CURLOPT_MIMEPOST(3), curl_for‐
68       madd(3), curl_formfree(3), curl_mime_init(3)
69
70
71
72libcurl 7.69.1                September 02, 2017           CURLOPT_HTTPPOST(3)
Impressum