Showing posts with label Whats is referrer URL and how to use it. Show all posts
Showing posts with label Whats is referrer URL and how to use it. Show all posts

Tuesday, 4 November 2014

How to get referrer URL in PHP


How to get referrer URL in PHP

Referrer show you where to user come on our site. In other words we can say last url of browser is Referrer URL.

<?php
$ref = getenv("HTTP_REFERER");
echo $ref;
?>
<?php
    if($_SESSION['refurl']==null)
    {
        $ref = getenv("HTTP_REFERER");
        $_SESSION['refurl']=$ref;
        echo $ref;
    }
    else
    {
   echo $_SESSION['refurl'];
    }
?>