I would like your help for the following problem, I have this code.
function encontrarValor($url){
$dominio = explode(".", parse_url($url, PHP_URL_HOST));
return $dominio[0];
}
It allows you to return the host name almost perfectly. However, if the host address has www
, it puts the server name as www
.
I would like your help to readjust this code so that even if url
of the server has www
, you can identify the server name perfectly.