1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I need Geo location script to get exact city name via IP

Discussion in 'PHP' started by bhunda, Nov 6, 2012.

  1. #1
    Hi,

    I need Geo location script to get exact city name via IP. I have seen so many scripts but problem is they provide me wrong city for dynamic ip. i need exact city via ip.

    please share me if you know about any script.
     
    bhunda, Nov 6, 2012 IP
  2. mnalam

    mnalam Member

    Messages:
    47
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    • Incorrect / Bad Information
    #2
    using the IP you can't detect the city OR exact location.
     
    mnalam, Nov 6, 2012 IP
  3. bhunda

    bhunda Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    then any other idea?
     
    bhunda, Nov 6, 2012 IP
  4. jadexe

    jadexe Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #4
    You can buy a database from ip2location.com.
     
    jadexe, Nov 7, 2012 IP
  5. playreblox

    playreblox Greenhorn

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    IPs are given by the internet service provider and where you local internet provider is it will say that you live in that city.
     
    playreblox, Nov 7, 2012 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    Yes - redesign what you need, because what you want isn't possible. Even if you could get a list of every single dynamic IP address in the world at this instant, it would be inaccurate by tomorrow.
     
    Rukbat, Nov 7, 2012 IP
  7. bhunda

    bhunda Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    How porn sites get exact city name on their ads?
     
    bhunda, Nov 8, 2012 IP
  8. Clickthroo

    Clickthroo Greenhorn

    Messages:
    10
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #8
    What area are you looking for a geo-script to cover?
     
    Clickthroo, Nov 8, 2012 IP
  9. bhunda

    bhunda Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #9
    I m looking for India.
     
    bhunda, Nov 8, 2012 IP
  10. selectaupairs

    selectaupairs Greenhorn

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    8
    #10
    selectaupairs, Nov 8, 2012 IP
  11. bhunda

    bhunda Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #11
    i have check but they cant able to give me exact city location :(
     
    bhunda, Nov 8, 2012 IP
  12. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #12
    IP addresses are registered with the company ( IE service provider ) that owns them. Back in the days when I used to be with AOL it showed me as from the US even though I was located in Germany.

    So you can't get 100% exact location. The scripts mentioned above is the best you will get.
     
    stephan2307, Nov 8, 2012 IP
  13. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #13
    I've never seen one get my location correctly. My provider's official location for the cable leg I'm on is about 4 towns over, so that's where every site thinks I am.
     
    Rukbat, Nov 8, 2012 IP
  14. bhunda

    bhunda Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #14
    I have seen so many dating and porn sites. they show their ads with my city name. how its working.
     
    bhunda, Nov 9, 2012 IP
  15. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #15
    Read above.
     
    stephan2307, Nov 9, 2012 IP
  16. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #16
    A lot of newbies commenting in this thread. You can Geo Target via IP. It will probably be 95% accurate or the returned city will be relatively close to the visitor. It requires an IP database that is updated regularly. IP2Location.com has a good database/service.
     
    NetStar, Nov 9, 2012 IP
  17. ROOFIS

    ROOFIS Well-Known Member

    Messages:
    1,234
    Likes Received:
    30
    Best Answers:
    5
    Trophy Points:
    120
    #17
    PHP has a GeoIP extension available though it requires compiling with maxmind.com's binaries and DB's (free)

    see the following:
    ---------------------------------------------------
    http://www.php.net/manual/en/ref.geoip.php (overview)
    http://www.php.net/manual/en/function.geoip-record-by-name.php
    http://www.php.net/manual/en/geoip.requirements.php
    ---------------------------------------------------
    DB's:
    http://dev.maxmind.com/geoip/geolite
    PHP DB: http://www.maxmind.com/download/geoip/api/php/
    and setup (see comments):
    http://www.php.net/manual/en/geoip.setup.php
    server install instruction:
    http://www.sunfinedata.com/tutorial/use-maxmind-geoip-database-in-your-php-application/
    ---------------------------------------------------

    Once set up you should be able to run something like this below:

    
    <?php
    $record = geoip_record_by_name($_SERVER['REMOTE_ADDR']);
    if ($record) {
        print_r($record);
    }
    ?>
    
    PHP:
    The above example will output:

    
    Array
    (
        [continent_code] => NA
        [country_code] => US
        [country_code3] => USA
        [country_name] => United States
        [region] => CA
        [city] => Marina Del Rey
        [postal_code] => 
        [latitude] => 33.9776992798
        [longitude] => -118.435096741
        [dma_code] => 803
        [area_code] => 310
    )
    snippet sample from: [URL="http://www.php.net/manual/en/function.geoip-record-by-name.php"]http://www.php.net/manual/en/function.geoip-record-by-name.php[/URL]  
    
    Code (markup):


    Good luck with it.



    ROOFIS:cool:
     
    ROOFIS, Nov 11, 2012 IP
  18. chrislim2888

    chrislim2888 Active Member

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #18
    It may not be exact location, but approximate. You may try ipinfodb, a free ip location service.
     
    chrislim2888, Nov 12, 2012 IP
  19. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #19
    use maxmind or ip2location.
    for me maxmind is beter than ip2location
     
    ogah, Nov 12, 2012 IP
  20. sitescripts

    sitescripts Active Member

    Messages:
    600
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    88
    Digital Goods:
    10
    #20
    This is actually really easy to do
    you just follow the hops


    Traceroute is the program that shows you the route over the network between two systems, listing all the intermediate routers a connection must pass through to get to its destination. It can help you determine why your connections to a given server might be poor, and can often help you figure out where exactly the problem is. It also shows you how systems are connected to each other, letting you see how your ISP connects to the Internet as well as how the target system is connected.
     
    sitescripts, Nov 14, 2012 IP