echo domain name in php code example Example: php get domain name from url parse_url('http://www.website.com/hey.php', PHP_URL_HOST);