CURLOPT_HTTPPOST.3 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_HTTPPOST 3 "May 17, 2022" "libcurl 7.85.0" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_HTTPPOST \- multipart formpost content
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
  32. struct curl_httppost *formpost);
  33. .SH DESCRIPTION
  34. Tells libcurl you want a multipart/formdata HTTP POST to be made and you
  35. instruct what data to pass on to the server in the \fIformpost\fP argument.
  36. Pass a pointer to a linked list of curl_httppost structs as parameter. The
  37. easiest way to create such a list, is to use \fIcurl_formadd(3)\fP as
  38. documented. The data in this list must remain intact as long as the curl
  39. transfer is alive and is using it.
  40. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  41. You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP.
  42. When setting \fICURLOPT_HTTPPOST(3)\fP, it will automatically set
  43. \fICURLOPT_NOBODY(3)\fP to 0.
  44. This option is deprecated! Do not use it. Use \fICURLOPT_MIMEPOST(3)\fP
  45. instead after having prepared mime data.
  46. .SH DEFAULT
  47. NULL
  48. .SH PROTOCOLS
  49. HTTP
  50. .SH EXAMPLE
  51. .nf
  52. /* Fill in the file upload field. This makes libcurl load data from
  53. the given file name when curl_easy_perform() is called. */
  54. curl_formadd(&formpost,
  55. &lastptr,
  56. CURLFORM_COPYNAME, "sendfile",
  57. CURLFORM_FILE, "postit2.c",
  58. CURLFORM_END);
  59. /* Fill in the filename field */
  60. curl_formadd(&formpost,
  61. &lastptr,
  62. CURLFORM_COPYNAME, "filename",
  63. CURLFORM_COPYCONTENTS, "postit2.c",
  64. CURLFORM_END);
  65. /* Fill in the submit field too, even if this is rarely needed */
  66. curl_formadd(&formpost,
  67. &lastptr,
  68. CURLFORM_COPYNAME, "submit",
  69. CURLFORM_COPYCONTENTS, "send",
  70. CURLFORM_END);
  71. .fi
  72. .SH AVAILABILITY
  73. As long as HTTP is enabled. Deprecated in 7.56.0.
  74. .SH RETURN VALUE
  75. Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
  76. .SH "SEE ALSO"
  77. .BR CURLOPT_POSTFIELDS "(3), " CURLOPT_POST "(3), " CURLOPT_MIMEPOST "(3),"
  78. .BR curl_formadd "(3), " curl_formfree "(3), " curl_mime_init "(3)"