curl_easy_init.3 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, 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. .TH curl_easy_init 3 "4 March 2002" "libcurl 7.8.1" "libcurl Manual"
  25. .SH NAME
  26. curl_easy_init - Start a libcurl easy session
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURL *curl_easy_init();
  31. .fi
  32. .SH DESCRIPTION
  33. This function must be the first function to call, and it returns a CURL easy
  34. handle that you must use as input to other functions in the easy
  35. interface. This call \fBMUST\fP have a corresponding call to
  36. \fIcurl_easy_cleanup(3)\fP when the operation is complete.
  37. If you did not already call \fIcurl_global_init(3)\fP, \fIcurl_easy_init(3)\fP
  38. does it automatically. This may be lethal in multi-threaded cases, since
  39. \fIcurl_global_init(3)\fP is not thread-safe, and it may result in resource
  40. problems because there is no corresponding cleanup.
  41. You are strongly advised to not allow this automatic behavior, by calling
  42. \fIcurl_global_init(3)\fP yourself properly. See the description in
  43. \fBlibcurl\fP(3) of global environment requirements for details of how to use
  44. this function.
  45. .SH EXAMPLE
  46. .nf
  47. CURL *curl = curl_easy_init();
  48. if(curl) {
  49. CURLcode res;
  50. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  51. res = curl_easy_perform(curl);
  52. curl_easy_cleanup(curl);
  53. }
  54. .fi
  55. .SH AVAILABILITY
  56. Always
  57. .SH RETURN VALUE
  58. If this function returns NULL, something went wrong and you cannot use the
  59. other curl functions.
  60. .SH "SEE ALSO"
  61. .BR curl_easy_cleanup "(3), " curl_global_init "(3), " curl_easy_reset "(3), "
  62. .BR curl_easy_perform "(3) "