Is there a way to make libcurl
not download the url but only the HTTP headers?
Depending on them I would like to decide if my program downloads the url .
Is there a way to make libcurl
not download the url but only the HTTP headers?
Depending on them I would like to decide if my program downloads the url .
To request the HEAD of a url in libcurl you have to set the option CURLOPT_NOBODY
= 1L
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://ejemplo.com");
// esto hace que se utilize el verbo HEAD en lugar de GET
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
res = curl_easy_perform(curl);
/* haz algo con las cabeceras... */
// siempre liberar los recursos
curl_easy_cleanup(curl);
}