<?php


function getServer($param){
    return isset($_SERVER[$param]) ? $_SERVER[$param] : "";
}

$connector = getServer("HTTP_REFERER");

if($connector == ""){
    echo "This is True<br/>";
    $connector = getServer("REMOTE_ADDR");
    
    if($connector == "")
        echo "No Chance 1";
}else{
    $connector = parse_url($connector);
    echo "Parse URL: ".print_r($connector, true)."<br/>";
    
    $connector = gethostbyname($connector["host"]);
}

echo $connector;