1curl_easy_init(3)               libcurl Manual               curl_easy_init(3)
2
3
4

NAME

6       curl_easy_init - Start a libcurl easy session
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURL *curl_easy_init();
12

DESCRIPTION

14       This function must be the first function to call, and it returns a CURL
15       easy handle that you must use as input to other functions in  the  easy
16       interface.    This   call   MUST   have   a   corresponding   call   to
17       curl_easy_cleanup(3) when the operation is complete.
18
19       If you did not already call curl_global_init(3), curl_easy_init(3) does
20       it  automatically.  This  may  be lethal in multi-threaded cases, since
21       curl_global_init(3) is not thread-safe, and it may result  in  resource
22       problems because there is no corresponding cleanup.
23
24       You are strongly advised to not allow this automatic behavior, by call‐
25       ing curl_global_init(3)  yourself  properly.  See  the  description  in
26       libcurl(3) of global environment requirements for details of how to use
27       this function.
28

EXAMPLE

30       CURL *curl = curl_easy_init();
31       if(curl) {
32         CURLcode res;
33         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
34         res = curl_easy_perform(curl);
35         curl_easy_cleanup(curl);
36       }
37

AVAILABILITY

39       Always
40

RETURN VALUE

42       If this function returns NULL, something went wrong and you cannot  use
43       the other curl functions.
44

SEE ALSO

46       curl_easy_cleanup(3),      curl_global_init(3),     curl_easy_reset(3),
47       curl_easy_perform(3)
48
49
50
51libcurl 8.0.1                  January 02, 2023              curl_easy_init(3)
Impressum