mercredi 2 septembre 2015

Cannot get referral URL PHP

I am trying to get the URL of the site which referred the user to the site with the script on it.

Here is the script I am using:

if (isset($_SERVER['HTTP_REFERER'])) {
    $ref_url = $_SERVER['HTTP_REFERER']; //get referrer
}else{
    $ref_url = 'none'; // show failure message
}
echo $ref_url;

The issue I am having is that no matter what site I come to the main site from, I always get 'none' echoed. What is causing this and how can I make the script actually get the referrers URL?

Aucun commentaire:

Enregistrer un commentaire