By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Detecting and displaying the domain name

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

"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

P: n/a
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

P: n/a

"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

P: n/a
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.