libcurl(3)
libcurl(3) 💅
okay bestie, welcome to the libcurl easy interface overview — yes, that’s the manual name, folded in near the top because we’re classy like that. ✨ This is the libcurl(3) page, and it’s giving “your first easy-handle era” energy. 🫶
✨ NAME ✨
libcurl-easy — easy interface overview
🌸 DESCRIPTION 🌸
okay so when you’re using libcurl’s “easy” interface, you init your session and get a handle (often referred to as an “easy handle”). You use that handle as input to the easy interface functions you use. Use curl_easy_init(3) to get the handle. 🫶
Then you continue by setting all the options you want in the upcoming transfer. The most important among them is the URL itself — and like, you can’t transfer anything without a specified URL, as you may have figured out yourself. 😭 You might want to set some callbacks as well, which will be called from the library when data is available etc. curl_easy_setopt(3) is used for all this.
CURLOPT_URL(3) is the only option you really must set, because otherwise there can be no transfer. Another commonly used option is CURLOPT_VERBOSE(3), which will help you see what libcurl is doing under the hood — very useful when debugging, for example. The curl_easy_setopt(3) man page has a full index of the over 200 available options. no cap, that’s a lot. 👑
If you at any point would like to blank all previously set options for a single easy handle, you can call curl_easy_reset(3). You can also make a clone of an easy handle (with all its set options) using curl_easy_duphandle(3). clone era 💅
When all is setup, you tell libcurl to perform the transfer using curl_easy_perform(3). It will then do the entire operation and won’t return until it is done (successfully or not). periodt. 💀
After the transfer has been made, you can set new options and make another transfer. Or, if you’re done, cleanup the session by calling curl_easy_cleanup(3). If you want persistent connections, you don’t cleanup immediately — instead, run ahead and perform other transfers using the same easy handle. persistent connection main character energy. 🔥
🦋 SEE ALSO 🦋
curl_easy_init(3)curl_easy_cleanup(3)curl_easy_setopt(3)libcurl-errors(3)libcurl-multi(3)libcurl(3)
source/version: libcurl · date: 19 Sep 2014 · manual: libcurl(3) — okay bye bestie, go slay those transfers 💖✨
📦 where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms