Puoi usare l'array globale $_SERVER che contiene le informazioni che ti servono:
http://php.net/manual/en/reserved.variables.server.php