2
0

CURLOPT_COOKIEJAR.3 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_COOKIEJAR 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_COOKIEJAR \- file name to store cookies to
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIEJAR, char *filename);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a \fIfilename\fP as char *, null-terminated. This will make libcurl write
  35. all internally known cookies to the specified file when
  36. \fIcurl_easy_cleanup(3)\fP is called. If no cookies are known, no file will be
  37. created. Specify "-" as filename to instead have the cookies written to
  38. stdout. Using this option also enables cookies for this session, so if you for
  39. example follow a location it will make matching cookies get sent accordingly.
  40. Note that libcurl does not read any cookies from the cookie jar. If you want to
  41. read cookies from a file, use \fICURLOPT_COOKIEFILE(3)\fP.
  42. If the cookie jar file cannot be created or written to (when the
  43. \fIcurl_easy_cleanup(3)\fP is called), libcurl will not and cannot report an
  44. error for this. Using \fICURLOPT_VERBOSE(3)\fP or
  45. \fICURLOPT_DEBUGFUNCTION(3)\fP will get a warning to display, but that is the
  46. only visible feedback you get about this possibly lethal situation.
  47. Since 7.43.0 cookies that were imported in the Set-Cookie format without a
  48. domain name are not exported by this option.
  49. The application does not have to keep the string around after setting this
  50. option.
  51. .SH DEFAULT
  52. NULL
  53. .SH PROTOCOLS
  54. HTTP
  55. .SH EXAMPLE
  56. .nf
  57. CURL *curl = curl_easy_init();
  58. if(curl) {
  59. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  60. /* export cookies to this file when closing the handle */
  61. curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
  62. ret = curl_easy_perform(curl);
  63. /* close the handle, write the cookies! */
  64. curl_easy_cleanup(curl);
  65. }
  66. .fi
  67. .SH AVAILABILITY
  68. Along with HTTP
  69. .SH RETURN VALUE
  70. Returns CURLE_OK if HTTP is supported, CURLE_UNKNOWN_OPTION if not, or
  71. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  72. .SH "SEE ALSO"
  73. .BR CURLOPT_COOKIEFILE "(3), " CURLOPT_COOKIE "(3), "
  74. .BR CURLOPT_COOKIELIST "(3), "