I'm using curl in my C++ program, and it is returning the HTML from the webpage. But I need it to only return the status code. I'm pretty sure the function that's returning the contents is called curl_easy_perform().
Long story short, I just need it to return the status code and not the content.
Here is my code.
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long response_code;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
}
curl_easy_cleanup(curl);
}