1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to display visitors referring domain?

Discussion in 'White Hat SEO' started by maineyak, Apr 1, 2008.

  1. maineyak

    maineyak Power Member

    Joined:
    Mar 27, 2008
    Messages:
    600
    Likes Received:
    555
    I use the below code to display what site the visitor is coming from:

    Code:
    <?php
    echo $_SERVER['HTTP_REFERER'];
    
    ?>
    Is there a way to display JUST the visiting domain, and not the webpage itself they came from?
     
  2. DeskCoder

    DeskCoder Regular Member

    Joined:
    Feb 20, 2008
    Messages:
    376
    Likes Received:
    55
    Occupation:
    Coder
    Location:
    Kentuckiana
    Can you manipulate the string??

    I know nothing about PHP, but find the first / after the . and take everything up until there.
     
  3. ArtfulWebSites

    ArtfulWebSites Newbie

    Joined:
    Sep 19, 2007
    Messages:
    35
    Likes Received:
    0
  4. Madeezy

    Madeezy Registered Member

    Joined:
    Mar 29, 2008
    Messages:
    79
    Likes Received:
    56
    Some years ago I had a nice little bit of code that displayed the 'location' of the visitor ie the town the isp was in. I have tried to find the code again but cant.

    Can anyone help me with some code that takes the ip and then throws the location up on the page the code is placed into????

    So I can use it to 'personalize the visitors page ala... Hi John Listen I know your from around (TOWN / LOCATION) but you can still bla bla bla

    Madeezy..