Connecting Tech Pros Worldwide Help | Site Map

Detecting and displaying the domain name

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:24 AM
Charles
Guest
 
Posts: n/a
Default 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.



  #2  
Old July 17th, 2005, 01:24 AM
Janwillem Borleffs
Guest
 
Posts: n/a
Default Re: Detecting and displaying the domain name


"Charles" <nothing@nothing.com> schreef in bericht
news:bqa597$1v0kt0$1@ID-208473.news.uni-berlin.de...[color=blue]
> 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[/color]
typed in, and display it[color=blue]
> on the page. Is there a way to do it?
> Thanks,
>[/color]

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


JW



  #3  
Old July 17th, 2005, 01:24 AM
Charles
Guest
 
Posts: n/a
Default Re: Detecting and displaying the domain name

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.


  #4  
Old July 17th, 2005, 01:24 AM
Janwillem Borleffs
Guest
 
Posts: n/a
Default Re: Detecting and displaying the domain name


"Charles" <nothing@nothing.com> schreef in bericht
news:bqa6e5$1vj1fr$1@ID-208473.news.uni-berlin.de...[color=blue]
> Thanks, it's working fine. Is there a way to display only the name with[/color]
www and extention such as:[color=blue]
>
> - name
>[/color]

Shure, per example with:

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


JW



  #5  
Old July 17th, 2005, 01:24 AM
Charles
Guest
 
Posts: n/a
Default Re: Detecting and displaying the domain name

Wow thank you very much Janwillem, you're very helpful.
Have a nice week-end,

--
Charles.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.