<?php
    $servername = $_SERVER['HTTP_HOST'];
    $headers = apache_request_headers();

    foreach ($headers as $header => $value) {
    	if($header == "Referer") {
            $headurl = $value;
        }
    }
?>
