php just get the domain name code example
Example 1: php get domain name from url
parse_url('http://www.website.com/hey.php', PHP_URL_HOST);
Example 2: php get domain name with https
echo $_SERVER['SERVER_NAME']; //Outputs www.example.com
parse_url('http://www.website.com/hey.php', PHP_URL_HOST);
echo $_SERVER['SERVER_NAME']; //Outputs www.example.com