PHP - Converting IP to Country

Discussion in 'PHP' started by cancer10, May 10, 2007.

  1. #1
    PHP - Converting IP to Country

    Hello,

    Is there any function/pre-made scripts in php which can tell me the name of country based on IP?


    For example: If I supply an IP 132.162.138.139 then the script would echo "India"

    Thanx in advance :)
     
    cancer10, May 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, May 11, 2007 IP
    CodyRo and nabil_kadimi like this.
  3. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    http://www.google.com/search?source=ig&hl=en&q=geoip+php&btnG=Google+Search

    The same reason people advertise their products and services on multiple forums / sites.. it increases their chances of being seen / heard / answered :).
     
    CodyRo, May 11, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Yes, and if he posts this on 5 forums, 4 people will have done their work for nothing. In this case here it's not a big deal, but when it's a programming question, people just waste their time...
     
    nico_swd, May 11, 2007 IP
  5. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You could say that about selling products too, it's just a more practical way to get a answer faster. No one is requiring anyone to answer, plus if the answer is posted on 5 forums maybe there will be less people in the future who will ask.

    I see your point, just playing devils advocate :)
     
    CodyRo, May 11, 2007 IP
  6. xooMan

    xooMan Peon

    Messages:
    92
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    We are using MaxMind GEO Ip database and API. It has free lite version which is still pretty accurate.
     
    xooMan, May 11, 2007 IP
  7. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #7
    Someone wrote a php extension for maxminds api, v easy to use, and maxmind themselves wrote a php version of thier api too if you can't install extensions
     
    krakjoe, May 11, 2007 IP
  8. JacobNix

    JacobNix Peon

    Messages:
    2,081
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hey

    i need the same
    but some like this
    you enter the website and it says
    you are from country from this ip


    really interested
     
    JacobNix, Jul 21, 2007 IP
  9. ds316

    ds316 Peon

    Messages:
    154
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I can't remember where I saw it but there is someone that provides an accurate IP-country database in csv format thats fairly easy to code for, i'll see if i can fish out the link again.
     
    ds316, Jul 22, 2007 IP
  10. webboy

    webboy Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I have this for a load balancing webpages , but unsure where i got it from

    you will need a sql db installed and the lall evel2 ip address

    really cool let me do some searching around , im me an i will send you the file
     
    webboy, Jul 22, 2007 IP