Jim Mullen wrote:
> You could use the $_SERVER['HTTP_HOST'] variable.
>
> Best regards,
> Jim Mullen
> Web: http://www.iDimensionz.com
> Twitter: http://twitter.com/iDimensionz
>
> Kal Durak wrote:
>
>> I am running virtual servers under Apache. I have an application that
>> needs to run under several of the servers. I need it to retrieve the
>> hostname that it is running under.
>>
>> I noticed that if you run phpinfo.php, under apache2handler, there is
>> a listing for hostname. This is exactly what I need, but I haven't
>> been able to find how to retrieve that variable.
>>
>> Any help would be greatly appreciated.
>>
This gets close, but doesn't quite do it. If my domain is
www.domain.com, I want a response of domain.com.
I tried simply using an if statement, but I the value is the same for
each domain. In other words, if my domains are www.domain1.com
www.domain2.com, both domains give me www.domain1.com. I think what is
happening is that the first domain that runs stores the value. Is there
a way to flush a variable?