Codice PHP:
<?php
echo "http://".$_SERVER['SERVER_NAME'];

Provare per credere