469,271 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Detecting and displaying the domain name

Hi,

I have a site that has several domains pointing to its DNS.
I would like to implement a script that will grab the domain name visitors typed in, and display it
on the page. Is there a way to do it?
Thanks,

--
Charles.
Jul 17 '05 #1
4 23656

"Charles" <no*****@nothing.com> schreef in bericht
news:bq*************@ID-208473.news.uni-berlin.de...
Hi,

I have a site that has several domains pointing to its DNS.
I would like to implement a script that will grab the domain name visitors typed in, and display it on the page. Is there a way to do it?
Thanks,


$_SERVER['HTTP_HOST'] (use phpinfo() to lookup vars like this)
JW

Jul 17 '05 #2
Thanks, it's working fine. Is there a way to display only the name with www and extention such as:

- name

instead of

- www.name.com

Thanks again,

--
Charles.
Jul 17 '05 #3

"Charles" <no*****@nothing.com> schreef in bericht
news:bq*************@ID-208473.news.uni-berlin.de...
Thanks, it's working fine. Is there a way to display only the name with www and extention such as:
- name


Shure, per example with:

$name = ereg_replace(
"^(www.)?([^.]+).[^.]+$", "\\2",
$_SERVER['HTTP_HOST']
);
JW

Jul 17 '05 #4
Wow thank you very much Janwillem, you're very helpful.
Have a nice week-end,

--
Charles.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Damon Morbius | last post: by
1 post views Thread by Luthor | last post: by
1 post views Thread by Dave Parkinson | last post: by
9 posts views Thread by D. Shane Fowlkes | last post: by
3 posts views Thread by andrew sargent | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.