Skip to content

Instantly share code, notes, and snippets.

@renanpalmeira
Created February 1, 2016 03:07
Show Gist options
  • Save renanpalmeira/9b362a864754a519cb42 to your computer and use it in GitHub Desktop.
Save renanpalmeira/9b362a864754a519cb42 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:8000");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
char *ct;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if((CURLE_OK == res) && ct)
printf("We received Content-Type: %s\n", ct);
}
curl_easy_cleanup(curl);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment