* Thus wrote Dan Anderson ([EMAIL PROTECTED]):
> I am creating a script and there is an autoconfig file.  I want to read
> in the web address of the server, and throw some correct URLs into the
> database.
> 
> Will using $_SERVER['HTTP_HOST'] guarantee getting me the domain name of
> the server on which the web page I am viewing is hosted?  
> 
> I am somewhat worried about using such variables because I seem to
> remember it being possible to disable them in PHP.ini, but I would love
> to get some feedback.

It rather depends on the webserver but in most cases it will be
there.  On apache the way it works is when you access the url
  http://yourhost.com/

The most browsers will send something like:
  GET / HTTP/1.1
  host: yourhost.com


The host: header is what HTTP_HOST is.  If you can access the site
by the IP, I'm not exactly sure what will happen in that case,
cause the browser may not send that host: value.


With all that said, if you have the HTTP_HOST value, it will most
likely be there. php has no control over that var, its set by the
webserver.

HTH

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to