GNURLOPT_REFERER(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸŽ€ GNURLOPT_REFERER(3) πŸŽ€

okay bestie, this is the gnurl manual page for GNURLOPT_REFERER(3) β€” aka the curl_easy_setopt options corner. it's giving β€œset the HTTP referer header” energy, and yes we're keeping every fact. πŸ’…

✨ NAME ✨

CURLOPT_REFERER β€” set the HTTP referer header. no cap, that's literally the whole name. πŸ¦‹

🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REFERER, char *where);

πŸ’– DESCRIPTION πŸ’–

Pass a pointer to a null-terminated string as parameter. that string gets used to set the Referer: header in the http request sent to the remote server. yes really β€” this can be used to fool servers or scripts. πŸ‘€

you can also set any custom header with CURLOPT_HTTPHEADER(3), bestie. and good news: the application does not have to keep the string around after setting this option. so no need to clutch that buffer forever. 🫢

πŸŽ€ DEFAULT πŸŽ€

NULL β€” that's the default. slay. πŸ’€

🌈 PROTOCOLS 🌈

HTTP β€” that's the protocol in the house. ✨

🧚 EXAMPLE 🧚

okay so here's the whole vibe in code, exactly as it goes:

       CURL *curl = curl_easy_init();
       if(curl) {
         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

         /* tell it where we found the link to this place */
         curl_easy_setopt(curl, CURLOPT_REFERER, "http://example.com/aboutme.html");

         curl_easy_perform(curl);
       }

πŸ‘‘ AVAILABILITY πŸ‘‘

if built with HTTP support. that's the whole condition, periodt. πŸ’…

⭐ RETURN VALUE ⭐

Returns CURLE_OK if HTTP support is enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. those are the three return values, bestie β€” no extras. 🫢

πŸ¦‹ SEE ALSO πŸ¦‹


mwah πŸ’‹ this page is from libcurl 7.37.0, dated 17 Jun 2014 β€” gnurl manual realness, signed off with sparkle. πŸŽ€βœ¨

πŸ“¦ where this page comes from