Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / docs / examples / getinfo.c
blob292b45905af2cc895b9aaec4148327fea9489926
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: getinfo.c,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
9 */
11 #include <stdio.h>
12 #include <curl/curl.h>
14 int main(void)
16 CURL *curl;
17 CURLcode res;
19 /* http://curl.haxx.se/libcurl/c/curl_easy_init.html */
20 curl = curl_easy_init();
21 if(curl) {
22 /* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL */
23 curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
24 /* http://curl.haxx.se/libcurl/c/curl_easy_perform.html */
25 res = curl_easy_perform(curl);
27 if(CURLE_OK == res) {
28 char *ct;
29 /* ask for the content-type */
30 /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */
31 res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
33 if((CURLE_OK == res) && ct)
34 printf("We received Content-Type: %s\n", ct);
37 /* always cleanup */
38 /* http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html */
39 curl_easy_cleanup(curl);
41 return 0;