How to format webpage by geo location?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FeeSupergeek

    How to format webpage by geo location?

    I've been told that I can make which page shows based on IP address and have seen examples, but never seen any corresponding code. (The company is a franchise and they want the website to show the correct state franchises they are viewed in)

    Has anyone done this before?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    You need a subscription for geolocation database or Web API.

    Then use submit your user's IP address, they return the info to you usually including country, state, long/lat, area code, etc.

    Here's an example that no longer works:


    If you google: PHP Geolocation, you'll get some hits.

    Cheers,

    Dan

    Comment

    • Shenno
      New Member
      • Sep 2010
      • 59

      #3
      i think each country have fixed ip addresses range which u can easly test using if.

      then u can include content according to ip address u got..

      Code:
      if($_SERVER["REMOTE_ADDR"] == " /* COUNTRY IP */")
      {
      include("specific_content.php"):
      }
      u can get that fixed ip addresses using lovely GOOGLE =)


      hope that helps.

      Comment

      Working...