Know Country with IP!! HELP!!

Discussion in 'PHP' started by AleckProg, Apr 20, 2007.

  1. #1
    Hello,

    I need one script to know country of one IP and shows it into my webpage. Please if somebody may help me how to do, reply.

    Thanks.
     
    AleckProg, Apr 20, 2007 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    http://ip-to-country.webhosting.info/

    You can download an IP to country database here, under the download section. From that, you can match a country based on the user's IP address.
     
    jestep, Apr 20, 2007 IP
  3. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #3
    ip2location first result on google might help you

    but i think its only for asp not sure
     
    commandos, Apr 20, 2007 IP
  4. chuckd1356

    chuckd1356 Active Member

    Messages:
    770
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    70
    #4
    Are you all set? Do you need any help writing this code?
     
    chuckd1356, Apr 20, 2007 IP
  5. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    According jstep download the database and this will solve your problem. I am also same thing it is working perfectly :)
     
    Subikar, Apr 20, 2007 IP
  6. AleckProg

    AleckProg Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I need more help here, because I don't know phpcode to set, help me completely please.
     
    AleckProg, Apr 20, 2007 IP
  7. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #7
    Are you able to put these in a database?

    Once they are in the database, you will want to do a query to get the selected ip address. Something like:

    
    
    $countryQuery = mysql_query("Select countryName From iptocountry Where inet_aton('".$_SERVER['REMOTE_ADDR']."') >= ipFrom && inet_aton('".$_SERVER['REMOTE_ADDR']."') <= ipTo");
    
    $country = mysql_result($countryQuery,0);
    
    
    PHP:
     
    jestep, Apr 20, 2007 IP
  8. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #8
    Barti1987, Apr 20, 2007 IP