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