La variabile d'ambiente $_SERVER["HTTP_HOST"] contiene cià che ti serve!