CURLOPT_REFERER.3 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .\" generated by cd2nroff 0.1 from CURLOPT_REFERER.md
  2. .TH CURLOPT_REFERER 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_REFERER \- the HTTP referer header
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REFERER, char *where);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a null\-terminated string as parameter. It is used to set the
  12. Referer: header field in the HTTP request sent to the remote server. You can
  13. set any custom header with \fICURLOPT_HTTPHEADER(3)\fP.
  14. The application does not have to keep the string around after setting this
  15. option.
  16. .SH DEFAULT
  17. NULL
  18. .SH PROTOCOLS
  19. This functionality affects http only
  20. .SH EXAMPLE
  21. .nf
  22. int main(void)
  23. {
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  27. /* tell it where we found the link to this place */
  28. curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/me.html");
  29. curl_easy_perform(curl);
  30. }
  31. }
  32. .fi
  33. .SH AVAILABILITY
  34. Added in curl 7.1
  35. .SH RETURN VALUE
  36. Returns CURLE_OK if HTTP support is enabled, CURLE_UNKNOWN_OPTION if not, or
  37. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  38. .SH SEE ALSO
  39. .BR CURLINFO_REDIRECT_URL (3),
  40. .BR CURLINFO_REFERER (3),
  41. .BR CURLOPT_HTTPHEADER (3),
  42. .BR CURLOPT_USERAGENT (3)