Geotargeting visitors to display different traffic based on origin

Discussion in 'PHP' started by telephone, Oct 17, 2006.

  1. #1
    Can someone please go over the basics of how a site admin can arrange for their site to display different content based on the geographic origin of a visitor?

    I understand the idea that sometimes site admins want to show one thing to humans and another thing to spiders for SEO purposes, but what can Joe Administrator do to arrange for a Japanese site visitor to see one thing while a Korean visitor sees another?

    I posted this on another part of the forum, where the thread got no traction, and it was recommended that I post here in the PHP area...
     
    telephone, Oct 17, 2006 IP
  2. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #2
    There are several GeoIP database providers on the net.
    One of them (maxmind) has PHP library and IP databases free for downloading.
    Check it out.
     
    wmtips, Oct 17, 2006 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Barti1987, Oct 17, 2006 IP
  4. telephone

    telephone Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    so using the tools you guys describe above, the visitors' IPs are detected, but what then tells the server to display certain content?
     
    telephone, Oct 18, 2006 IP
  5. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You would get their country from their IP address in your scripts and then based on this you would serve them different content.
     
    streety, Oct 18, 2006 IP
  6. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #6
    For example in the free script mentioned above, which uses a function:
    $ucountry = get_country();
    if($ucountry=="japan")
    {
    print 'Japan message';
    }
    else
    {
    print 'Korea message';
    }

    If you want to target many more countries, use "switch" instead of "if" statement.
    Hope that helps you...
    Bye :)
     
    JEET, Oct 18, 2006 IP
  7. telephone

    telephone Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thank you Jeet, that is helpful!
     
    telephone, Oct 25, 2006 IP