CURLOPT_HTTPPOST.3 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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 "17 Jun 2014" libcurl libcurl
  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. \fBThis option is deprecated.\fP Use \fICURLOPT_MIMEPOST(3)\fP instead.
  35. Tells libcurl you want a \fBmultipart/formdata\fP HTTP POST to be made and you
  36. instruct what data to pass on to the server in the \fIformpost\fP argument.
  37. Pass a pointer to a linked list of \fIcurl_httppost\fP structs as parameter.
  38. The easiest way to create such a list, is to use \fIcurl_formadd(3)\fP as
  39. documented. The data in this list must remain intact as long as the curl
  40. transfer is alive and is using it.
  41. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  42. You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP.
  43. When setting \fICURLOPT_HTTPPOST(3)\fP, it will automatically set
  44. \fICURLOPT_NOBODY(3)\fP to 0.
  45. .SH DEFAULT
  46. NULL
  47. .SH PROTOCOLS
  48. HTTP
  49. .SH EXAMPLE
  50. .nf
  51. /* Fill in the file upload field. This makes libcurl load data from
  52. the given file name when curl_easy_perform() is called. */
  53. curl_formadd(&formpost,
  54. &lastptr,
  55. CURLFORM_COPYNAME, "sendfile",
  56. CURLFORM_FILE, "postit2.c",
  57. CURLFORM_END);
  58. /* Fill in the filename field */
  59. curl_formadd(&formpost,
  60. &lastptr,
  61. CURLFORM_COPYNAME, "filename",
  62. CURLFORM_COPYCONTENTS, "postit2.c",
  63. CURLFORM_END);
  64. /* Fill in the submit field too, even if this is rarely needed */
  65. curl_formadd(&formpost,
  66. &lastptr,
  67. CURLFORM_COPYNAME, "submit",
  68. CURLFORM_COPYCONTENTS, "send",
  69. CURLFORM_END);
  70. .fi
  71. .SH AVAILABILITY
  72. As long as HTTP is enabled. Deprecated in 7.56.0.
  73. .SH RETURN VALUE
  74. Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
  75. .SH "SEE ALSO"
  76. .BR CURLOPT_POSTFIELDS "(3), " CURLOPT_POST "(3), " CURLOPT_MIMEPOST "(3),"
  77. .BR curl_formadd "(3), " curl_formfree "(3), " curl_mime_init "(3)"