1CURLINFO_REFERER(3) curl_easy_getinfo options CURLINFO_REFERER(3)
2
3
4
6 CURLINFO_REFERER - get the referrer header
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REFERER, char
12 **hdrp);
13
15 Pass in a pointer to a char pointer and get the referrer header.
16
17 The hdrp pointer will be NULL or pointing to private memory you MUST
18 NOT free - it gets freed when you call curl_easy_cleanup(3) on the cor‐
19 responding CURL handle.
20
22 HTTP(S)
23
25 CURL *curl = curl_easy_init();
26 if(curl) {
27 CURLcode res;
28 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
29 curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/referrer");
30 res = curl_easy_perform(curl);
31 if(res == CURLE_OK) {
32 char *hdr = NULL;
33 curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
34 if(hdr)
35 printf("Referrer header: %s\n", hdr);
36 }
37 curl_easy_cleanup(curl);
38 }
39
41 Added in 7.76.0
42
44 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
45 if not.
46
48 curl_easy_getinfo(3), curl_easy_setopt(3), CURLOPT_REFERER(3),
49
50
51
52libcurl 7.79.1 February 19, 2021 CURLINFO_REFERER(3)