How to determine the Country and Organization from IP

Discussion in 'Java' started by Amardeep Verma, Aug 7, 2003.

  1. Hi,
    I would like to determine the Country and Organization from a given
    IP. I have to write a JSP, which when given the IP address gives the
    country and the organization to which the IP belongs. The organization
    may be the ISP, or a MNC or any other corporate/government body, or it
    may be of an individual. I have to do it progamitically from inside a
    JSP?
    Any suggestions anybody

    Thanks in Advance for your reply
     
    Amardeep Verma, Aug 7, 2003
    #1
    1. Advertising

  2. Amardeep Verma

    Grant Wagner Guest

    Amardeep Verma wrote:

    > Hi,
    > I would like to determine the Country and Organization from a given
    > IP. I have to write a JSP, which when given the IP address gives the
    > country and the organization to which the IP belongs. The organization
    > may be the ISP, or a MNC or any other corporate/government body, or it
    > may be of an individual. I have to do it progamitically from inside a
    > JSP?
    > Any suggestions anybody
    >
    > Thanks in Advance for your reply


    Do a whois lookup, then parse the results that are returned. You could do
    something as simple as:

    <url: http://ws.arin.net/cgi-bin/whois.pl?queryinput=127.0.0.1 />

    then parse the HTML returned.

    Or find some service that allows SOAP calls, or a service that returns the
    data in an easier to parse format, such as XML or comma-delimited.

    --
    | Grant Wagner <>
     
    Grant Wagner, Aug 7, 2003
    #2
    1. Advertising

  3. One problem with this (as I have found recently) is that there are four
    ***independent*** regional Internet registries. However, the American
    (North) and sub-equatorial African registry (ARIN - www.arin.net) does seem
    to point you to which registry does contain the information, if they don't,
    on a regular basis. This will require more parsing on your behalf.

    The four registries are:

    APNIC (http://www.apnic.net/) - Asia (Pacific).
    ARIN (http://www.arin.net/) - North America, (part of) the Caribbean, and
    sub-equatorial Africa.
    LACNIC (http://lacnit.net/) - Latin America and the Caribbean.
    RIPE (http://www.ripe.net/) - Europe, the Middle East, Central Asia, and
    Africa.

    I don't know if there is a central database (there probably isn't), but some
    web-sites do query all of the registries. I knew one that would allow HTTP
    GET requests, but it's disappeared from my browser history (?!?!).

    Michael

    --
    M.Winter@(I_hate_spam)blueyonder.co.uk
    Remove "(I_hate_spam)" to reply.

    "Grant Wagner" <> wrote in message
    news:...
    > Amardeep Verma wrote:
    >
    > > Hi,
    > > I would like to determine the Country and Organization from a given
    > > IP. I have to write a JSP, which when given the IP address gives the
    > > country and the organization to which the IP belongs. The organization
    > > may be the ISP, or a MNC or any other corporate/government body, or it
    > > may be of an individual. I have to do it progamitically from inside a
    > > JSP?
    > > Any suggestions anybody
    > >
    > > Thanks in Advance for your reply

    >
    > Do a whois lookup, then parse the results that are returned. You could do
    > something as simple as:
    >
    > <url: http://ws.arin.net/cgi-bin/whois.pl?queryinput=127.0.0.1 />
    >
    > then parse the HTML returned.
    >
    > Or find some service that allows SOAP calls, or a service that returns the
    > data in an easier to parse format, such as XML or comma-delimited.
    >
    > --
    > | Grant Wagner <>
    >
     
    Michael Winter, Aug 7, 2003
    #3
  4. Amardeep Verma

    Roedy Green Guest

    Roedy Green, Aug 8, 2003
    #4
  5. Amardeep Verma

    Roedy Green Guest

    On Fri, 08 Aug 2003 21:23:58 +0100, Mark Thornton
    <> wrote or quoted :

    >Note that this does not reliably tell you where the user is located. For
    >example I think it is AOL who use IP addresses from their US allocation
    >for customers everywhere (in the UK for example).


    For example, I looked up my own website's IP and discovered it was
    allocated to "bigpipe". This is not me, and not my ISP but at least
    one higher up the food chain.
    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Aug 9, 2003
    #5
  6. Amardeep Verma

    Neomorph Guest

    On Sat, 09 Aug 2003 01:40:11 GMT, Roedy Green <>
    two-finger typed:

    >On Fri, 08 Aug 2003 21:23:58 +0100, Mark Thornton
    ><> wrote or quoted :
    >
    >>Note that this does not reliably tell you where the user is located. For
    >>example I think it is AOL who use IP addresses from their US allocation
    >>for customers everywhere (in the UK for example).

    >
    >For example, I looked up my own website's IP and discovered it was
    >allocated to "bigpipe". This is not me, and not my ISP but at least
    >one higher up the food chain.


    You could do a reverse DNS call to at least get the full name of the
    machine. This will give you a name that may tell you more.

    It is basically impossible to get a true geographic location on every
    machine through their IP number, though. You would have to equip each
    machine with a GPS system that is always accessible through the internet
    ;-)

    Cheers.
     
    Neomorph, Aug 9, 2003
    #6
  7. Amardeep Verma

    Roedy Green Guest

    Roedy Green, Aug 11, 2003
    #7
  8. Amardeep Verma

    Roedy Green Guest


    >
    > Thank you guys for sharing your thoughts with me. IF you have
    >anything more to add, please do post it.


    Maybe there is some relative of PING you can use to find out where a
    site is. Not every site would implement it. If not, maybe it is time
    to invent such an identifying protocol, that would give you a vcard
    for the IP. It might also present public keys for the site.
    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Aug 11, 2003
    #8
  9. Hi,
    use MaxMind GeoIP (http://www.maxmind.com/)

    Amir Pashazadeh

    "Amardeep Verma" <> wrote in message
    news:...
    > Hi,
    > I would like to determine the Country and Organization from a given
    > IP. I have to write a JSP, which when given the IP address gives the
    > country and the organization to which the IP belongs. The organization
    > may be the ISP, or a MNC or any other corporate/government body, or it
    > may be of an individual. I have to do it progamitically from inside a
    > JSP?
    > Any suggestions anybody
    >
    > Thanks in Advance for your reply
     
    Amir Pashazadeh, Aug 26, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S.Guhananth
    Replies:
    1
    Views:
    571
    Alvin Bruney [Microsoft MVP]
    Apr 30, 2005
  2. Tan
    Replies:
    1
    Views:
    321
    Sean M
    Aug 2, 2005
  3. Zyron
    Replies:
    2
    Views:
    1,536
    Jukka K. Korpela
    Nov 8, 2005
  4. Peña, Botp
    Replies:
    1
    Views:
    261
    Robert Klemme
    Jan 24, 2004
  5. Petr Janda
    Replies:
    2
    Views:
    180
    rretzbach
    Mar 8, 2007
Loading...

Share This Page