• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: libcurl
5Section: 3
6Source: libcurl
7See-also:
8  - curl_easy_cleanup (3)
9  - curl_easy_init (3)
10  - curl_easy_setopt (3)
11  - libcurl (3)
12  - libcurl-errors (3)
13  - libcurl-multi (3)
14---
15
16# NAME
17
18libcurl-easy - easy interface overview
19
20# DESCRIPTION
21
22When using libcurl's "easy" interface you init your session and get a handle
23(often referred to as an "easy handle"), which you use as input to the easy
24interface functions you use. Use curl_easy_init(3) to get the handle.
25
26You continue by setting all the options you want in the upcoming transfer, the
27most important among them is the URL itself (you cannot transfer anything
28without a specified URL as you may have figured out yourself). You might want
29to set some callbacks as well that are called from the library when data is
30available etc. curl_easy_setopt(3) is used for all this.
31
32CURLOPT_URL(3) is the only option you really must set, as otherwise
33there can be no transfer. Another commonly used option is
34CURLOPT_VERBOSE(3) that helps you see what libcurl is doing under the
35hood, which is useful when debugging for example. The
36curl_easy_setopt(3) man page has a full index of the almost 300
37available options.
38
39If you at any point would like to blank all previously set options for a
40single easy handle, you can call curl_easy_reset(3) and you can also
41make a clone of an easy handle (with all its set options) using
42curl_easy_duphandle(3).
43
44When all is setup, you tell libcurl to perform the transfer using
45curl_easy_perform(3). It performs the entire transfer operation and does
46not return until it is done (successfully or not).
47
48After the transfer has been made, you can set new options and make another
49transfer, or if you are done, cleanup the session by calling
50curl_easy_cleanup(3). If you want persistent connections, you do not
51cleanup immediately, but instead run ahead and perform other transfers using
52the same easy handle.
53