Puoi utilizzare la funzione parse_url()

Codice PHP:
$url "http://www.example.com/a/b/c/asd.php";
parse_url($urlPHP_URL_HOST); 
fa al caso tuo.