You are here : Ccurl/curl.hcurl_easy_init

curl_easy_init() - curl/curl.h

curl_easy_init - Start a libcurl easy session.
This function must be the first function to call, and it returns a CURL easy handle that you must use as input to other functions in the easy interface. This call MUST have a corresponding call to curl_easy_cleanup when the operation is complete.


Syntax

#include <curl/curl.h>

CURL *curl_easy_init( );


Example

#include <curl/curl.h>

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  res = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}


Output / Return Value

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


Limitations


Alternatives / See Also


Reference

http://curl.haxx.se/libcurl/c/curl_easy_init.html