libcurl Easy Interface


When using libcurl's "easy" interface, initialize your session and get a handle (often referred to as an 'easy handle') that is then used as input to the easy interface functions that you use. Use curl_easy_init to get the handle.

Continue by setting the required options in the upcoming transfer. The most important among them is the URL itself (you cannot transfer anything without a specified URL). You may want to set some callbacks as well that will be called from the library when data is available etc. Use curl_easy_setopt for this.

When setup, instruct libcurl to perform the transfer using curl_easy_perform. The entire operation is performed and will not return until done (successfully or not).

After the transfer has been made, set new options and make another transfer, or if done, cleanup the session by calling curl_easy_cleanup. If you want persistent connections, do not clean up immediately, but instead perform other transfers using the same easy handle.

See Also

HTTP Client Library (libcurl)

Revision History

2013/09/12 Converted.