In PHP, is there a reliable and good way of getting these things:
Protocol: i.e. http or https Servername: e.g. localhost Portnumber: e.g. 8080
Why don't you get full url like this
strtolower(array_shift(explode("/",$_SERVER['SERVER_PROTOCOL'])))."://".$_SERVER['SERVER_NAME'];
or (If you want host name from HTTP)
strtolower(array_shift(explode("/",$_SERVER['SERVER_PROTOCOL'])))."://".$_SERVER['HTTP_HOST'];