CURLOPT_HTTPPOST.3 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2017, 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.haxx.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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_HTTPPOST 3 "September 02, 2017" "libcurl 7.61.1" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_HTTPPOST \- specify the multipart formpost content
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
  30. struct curl_httppost *formpost);
  31. .SH DESCRIPTION
  32. Tells libcurl you want a multipart/formdata HTTP POST to be made and you
  33. instruct what data to pass on to the server in the \fIformpost\fP argument.
  34. Pass a pointer to a linked list of curl_httppost structs as parameter. The
  35. easiest way to create such a list, is to use \fIcurl_formadd(3)\fP as
  36. documented. The data in this list must remain intact as long as the curl
  37. transfer is alive and is using it.
  38. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
  39. You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP.
  40. When setting \fICURLOPT_HTTPPOST(3)\fP, it will automatically set
  41. \fICURLOPT_NOBODY(3)\fP to 0.
  42. This option is deprecated! Do not use it. Use \fICURLOPT_MIMEPOST(3)\fP
  43. instead after having prepared mime data.
  44. .SH DEFAULT
  45. NULL
  46. .SH PROTOCOLS
  47. HTTP
  48. .SH EXAMPLE
  49. .nf
  50. /* Fill in the file upload field. This makes libcurl load data from
  51. the given file name when curl_easy_perform() is called. */
  52. curl_formadd(&formpost,
  53. &lastptr,
  54. CURLFORM_COPYNAME, "sendfile",
  55. CURLFORM_FILE, "postit2.c",
  56. CURLFORM_END);
  57. /* Fill in the filename field */
  58. curl_formadd(&formpost,
  59. &lastptr,
  60. CURLFORM_COPYNAME, "filename",
  61. CURLFORM_COPYCONTENTS, "postit2.c",
  62. CURLFORM_END);
  63. /* Fill in the submit field too, even if this is rarely needed */
  64. curl_formadd(&formpost,
  65. &lastptr,
  66. CURLFORM_COPYNAME, "submit",
  67. CURLFORM_COPYCONTENTS, "send",
  68. CURLFORM_END);
  69. .fi
  70. .SH AVAILABILITY
  71. As long as HTTP is enabled. Deprecated in 7.56.0.
  72. .SH RETURN VALUE
  73. Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
  74. .SH "SEE ALSO"
  75. .BR CURLOPT_POSTFIELDS "(3), " CURLOPT_POST "(3), " CURLOPT_MIMEPOST "(3),"
  76. .BR curl_formadd "(3), " curl_formfree "(3), " curl_mime_init "(3)"