Is it possible to retrieve the referring page of a guest using PHP sessions or server variables?

When a user visits a website, the referrer information (the previous page they were on) is typically passed along in the HTTP headers. This information can be accessed in PHP using the $_SERVER['HTTP_REFERER'] variable. However, it's important to note that this information can sometimes be unreliable or not present, as some browsers or security settings may block or strip this data.

// Retrieve the referring page of a guest using PHP
if(isset($_SERVER['HTTP_REFERER'])){
    $referrer = $_SERVER['HTTP_REFERER'];
    echo "Referring page: " . $referrer;
} else {
    echo "Referring page not available.";
}