1CURLOPT_REFERER(3) curl_easy_setopt options CURLOPT_REFERER(3)
2
3
4
6 CURLOPT_REFERER - set the HTTP referer header
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REFERER, char *where);
12
14 Pass a pointer to a zero terminated string as parameter. It will be
15 used to set the Referer: header in the http request sent to the remote
16 server. This can be used to fool servers or scripts. You can also set
17 any custom header with CURLOPT_HTTPHEADER(3).
18
19 The application does not have to keep the string around after setting
20 this option.
21
23 NULL
24
26 HTTP
27
29 CURL *curl = curl_easy_init();
30 if(curl) {
31 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
32
33 /* tell it where we found the link to this place */
34 curl_easy_setopt(curl, CURLOPT_REFERER, "http://example.com/aboutme.html");
35
36 curl_easy_perform(curl);
37 }
38
40 If built with HTTP support
41
43 Returns CURLE_OK if HTTP support is enabled, CURLE_UNKNOWN_OPTION if
44 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
45
47 CURLOPT_USERAGENT(3), CURLOPT_HTTPHEADER(3),
48
49
50
51libcurl 7.61.1 December 21, 2016 CURLOPT_REFERER(3)