get domain name with https in php code example Example: php get domain name with https echo $_SERVER['SERVER_NAME']; //Outputs www.example.com