Detecting and displaying the domain name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles

    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.


  • Janwillem Borleffs

    #2
    Re: Detecting and displaying the domain name


    "Charles" <nothing@nothin g.com> schreef in bericht
    news:bqa597$1v0 kt0$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



    Comment

    • Charles

      #3
      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.


      Comment

      • Janwillem Borleffs

        #4
        Re: Detecting and displaying the domain name


        "Charles" <nothing@nothin g.com> schreef in bericht
        news:bqa6e5$1vj 1fr$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



        Comment

        • Charles

          #5
          Re: Detecting and displaying the domain name

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

          --
          Charles.


          Comment

          Working...