1
/*****************************************************************************
3
* Project ___| | | | _ \| |
5
* | (__| |_| | _ <| |___
6
* \___|\___/|_| \_\_____|
8
* $Id: httpcustomheader.c,v 1.2 2009-01-12 21:29:23 bagder Exp $
12
#include <curl/curl.h>
19
curl = curl_easy_init();
21
struct curl_slist *chunk = NULL;
23
chunk = curl_slist_append(chunk, "Accept: moo");
24
chunk = curl_slist_append(chunk, "Another: yes");
26
/* request with the built-in Accept: */
27
curl_easy_setopt(curl, CURLOPT_URL, "localhost");
28
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
29
res = curl_easy_perform(curl);
31
/* redo request with our own custom Accept: */
32
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
33
res = curl_easy_perform(curl);
36
curl_easy_cleanup(curl);