1CURLINFO_REFERER(3) libcurl 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 **hdrp);
12
14 Pass in a pointer to a char pointer and get the referrer header.
15
16 The hdrp pointer will be NULL or pointing to private memory you MUST
17 NOT free - it gets freed when you call curl_easy_cleanup(3) on the cor‐
18 responding CURL handle.
19
21 HTTP(S)
22
24 CURL *curl = curl_easy_init();
25 if(curl) {
26 CURLcode res;
27 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
28 curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/referrer");
29 res = curl_easy_perform(curl);
30 if(res == CURLE_OK) {
31 char *hdr = NULL;
32 curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
33 if(hdr)
34 printf("Referrer header: %s\n", hdr);
35 }
36 curl_easy_cleanup(curl);
37 }
38
40 Added in 7.76.0
41
43 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
44 if not.
45
47 curl_easy_getinfo(3), curl_easy_setopt(3), CURLOPT_REFERER(3),
48
49
50
51ibcurl 8.2.1 April 26, 2023 CURLINFO_REFERER(3)