Built From Developers For Developers
» Kuikie.com » Snippets » PHP » Other » PHP. Get the Referrer to the Current Webpage
  Categories
  PHP
    Arrays
    Date & Time
    Files & Directories
    Globalization
    Images
    OOP
    Other
    Strings
    User Interface
 

PHP. Get the Referrer to the Current Webpage

You can find the referer to the current webpage by using the $_SERVER["HTTP_REFERER"] variable. This is possible because when you browse the pages, the browser passes the URL it came from. Note: The HTTP_REFERER can not be fully trusted. Many browsers provide the ability to modify the referrer variable. Additionally, if a user is behind a firewall, the referrer variable can be empty or changed.

<?php
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
?>
 
©2012 Sinevia Ltd Terms of Use         Privacy Policy Valid XHTML 1.0 Transitional