1CURLINFO_REDIRECT_COUNT(3) curl_easy_getinfo optionsCURLINFO_REDIRECT_COUNT(3)
2
3
4

NAME

6       CURLINFO_REDIRECT_COUNT - get the number of redirects
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT, long
12       *countp);
13

DESCRIPTION

15       Pass a pointer to a long to receive the total  number  of  redirections
16       that were actually followed.
17

PROTOCOLS

19       HTTP(S)
20

EXAMPLE

22       CURL *curl = curl_easy_init();
23       if(curl) {
24         CURLcode res;
25         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
26         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
27         res = curl_easy_perform(curl);
28         if(res == CURLE_OK) {
29           long redirects;
30           curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
31         }
32         curl_easy_cleanup(curl);
33       }
34

AVAILABILITY

36       Added in 7.9.7
37

RETURN VALUE

39       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
40       if not.
41

SEE ALSO

43       curl_easy_getinfo(3), curl_easy_setopt(3),
44
45
46
47libcurl 7.79.1                 November 04, 2020    CURLINFO_REDIRECT_COUNT(3)
Impressum