177ada359008928c92e0c4c076d79289a0a6a029
[external/curl.git] / docs / examples / persistant.c
1 /*****************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  */
9
10 #include <stdio.h>
11 #include <unistd.h>
12 #include <curl/curl.h>
13
14 int main(int argc, char **argv)
15 {
16   CURL *curl;
17   CURLcode res;
18
19   curl_global_init(CURL_GLOBAL_ALL);
20
21   curl = curl_easy_init();
22   if(curl) {
23     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
24     curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
25
26     /* get the first document */
27     curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
28     res = curl_easy_perform(curl);
29
30     /* get another document from the same server using the same
31        connection */
32     curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/");
33     res = curl_easy_perform(curl);
34
35     /* always cleanup */
36     curl_easy_cleanup(curl);
37   }
38
39   return 0;
40 }