HTTP_REFERER: Find the referrer page with php

It's very easy to get the referrer page with php, it's just one line of code:
<?php
$URL = $_SERVER['HTTP_REFERER'];
echo $URL;
?>

$_SERVER['HTTP_REFERER'] is a php server variable that enable you to get the url of the referrer page, from where your visitor is coming.

Referer script is used for many reasons, some of them are creating web traffic statistics, or allowing only visitors from a one website to see your website.

2 comments:

Unknown said...

Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well

PSD to Wordpress
wordpress website development

pregnancy test said...

This is very great and brilliant information.