diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-03-17 08:57:31 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-03-17 08:57:31 +0100 |
commit | 40914fd544efb8c2fa14783351d1dd17619d91fb (patch) | |
tree | 9d3499c8266deac35420e6146af77791277f6a07 /docs/libcurl/opts/CURLOPT_HTTPHEADER.3 | |
parent | 8c41f368f5f3be2738221a107d715ef1d3c4506e (diff) | |
download | curl-40914fd544efb8c2fa14783351d1dd17619d91fb.tar.gz |
CURLOPT_*.3: more examples and edits
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_HTTPHEADER.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_HTTPHEADER.3 | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 b/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 index 10fcf08f0..ad0134031 100644 --- a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 +++ b/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -73,11 +73,29 @@ NULL .SH PROTOCOLS HTTP .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); + +struct curl_slist *list = NULL; + +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + list = curl_slist_append(list, "Shoesize: 10"); + list = curl_slist_append(list, "Accept:"); + + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); + + curl_easy_perform(curl); + + curl_slist_free_all(list); /* free the list again */ +} +.fi + .SH AVAILABILITY As long as HTTP is enabled .SH RETURN VALUE Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. .SH "SEE ALSO" .BR CURLOPT_CUSTOMREQUEST "(3), " CURLOPT_HEADEROPT "(3), " -.BR CURLOPT_PROXYHEADER "(3)" +.BR CURLOPT_PROXYHEADER "(3), " CURLOPT_HEADER "(3)" |