I want to echo the entered domain name, without the addition of http://www. and I want to split the TLD from the domain.
How can I display this and what is stable solution?
I currenty have this, but that is displaying including www. and I do not know if this is a stable solution or to split the TLD.
<?php echo "{$_SERVER['HTTP_HOST']}\n"; ?>
EDIT using parse_url():
<?php $url = "{$_SERVER['HTTP_HOST']}";
var_dump(parse_url($url));
var_dump(parse_url($url, PHP_URL_SCHEME));
var_dump(parse_url($url, PHP_URL_USER));
var_dump(parse_url($url, PHP_URL_PASS));
var_dump(parse_url($url, PHP_URL_HOST));
var_dump(parse_url($url, PHP_URL_PORT));
var_dump(parse_url($url, PHP_URL_PATH));
var_dump(parse_url($url, PHP_URL_QUERY));
var_dump(parse_url($url, PHP_URL_FRAGMENT));
?>