$h = $_SERVER['HTTP_REFERER'], 'facebook.com';
if (strpos($h, ':')>0)
{
$h = explode(":",$h);
$h=$h[0];
};