~ubuntu-branches/ubuntu/dapper/curl/dapper-security

« back to all changes in this revision

Viewing changes to docs/examples/getinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-03-23 18:41:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050323184129-le70d05a0hk5w62j
Tags: 7.12.3-2ubuntu3
Fix the version numbers internal to debian/rules.  Closes; #8088

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *                                  _   _ ____  _
 
3
 *  Project                     ___| | | |  _ \| |
 
4
 *                             / __| | | | |_) | |
 
5
 *                            | (__| |_| |  _ <| |___
 
6
 *                             \___|\___/|_| \_\_____|
 
7
 *
 
8
 * $Id: getinfo.c,v 1.2 2004/11/22 16:24:46 bagder Exp $
 
9
 */
 
10
 
 
11
#include <stdio.h>
 
12
#include <curl/curl.h>
 
13
 
 
14
int main(void)
 
15
{
 
16
  CURL *curl;
 
17
  CURLcode res;
 
18
 
 
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);
 
26
 
 
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);
 
32
 
 
33
      if((CURLE_OK == res) && ct)
 
34
        printf("We received Content-Type: %s\n", ct);
 
35
    }
 
36
 
 
37
    /* always cleanup */
 
38
    /* http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html */
 
39
    curl_easy_cleanup(curl);
 
40
  }
 
41
  return 0;
 
42
}