diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-05-05 17:26:08 +0200 |
---|---|---|
committer | ng0 <ng0@infotropique.org> | 2017-08-22 15:26:14 +0000 |
commit | b296d13f6f22fda3768a1f80e411f92a3caf12c8 (patch) | |
tree | d2be30b690f8db21a2a835e8863cd804baa31a7e /docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 | |
parent | c1f85bc35cb86778fd800d9d0d44119fe31f370b (diff) | |
download | gnurl-b296d13f6f22fda3768a1f80e411f92a3caf12c8.tar.gz gnurl-b296d13f6f22fda3768a1f80e411f92a3caf12c8.tar.bz2 gnurl-b296d13f6f22fda3768a1f80e411f92a3caf12c8.zip |
docs/opts: 24 more man pages now have examples
Diffstat (limited to 'docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3')
-rw-r--r-- | docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 index ee1ebbb62..61d79830b 100644 --- a/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 +++ b/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2017, 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 @@ -33,7 +33,20 @@ actually followed. .SH PROTOCOLS HTTP(S) .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long redirects; + curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects); + } + curl_easy_cleanup(curl); +} +.fi .SH AVAILABILITY Added in 7.9.7 .SH RETURN VALUE |