==== What is it: ================================================================================================================== ip2c.org exists to resolve IPs to country codes/names. | + fast and simple + updated daily + has information on over 4,183,000,000 IPv4s » please read Inputs and Outputs sections for instructions This service is FREE because we strongly support technology sharing. FREE does not imply low quality. Our uptime has been 99.95% since the beginning of 2009, courtesy of ultra-simple design. Amount of requests per user / per day is unlimited, just be reasonable. Currently we can sustain a maximum of about 30 million per day.
==== News: ======================================================================================================================== Oct 4 13 months and 264 million requests later, our give:take ratio has gone from 37k:1 to 141k:1 (6.5 year total). Last month alone is 1.3m:1. 2014 Oct 17 Domain renamed to ip2c.org for convenience. GeoLoc.daiguo.com still works for backwards compatibility. Sep 9 Added new input notations based on mod_rewrite. This upgrade is minor but long due. Sep 7 We have seen around the Net people assume this service simply forwards requests to Software77 servers. In reality, since day 1, this service resolves requests locally, and calls Software77 once a day for updated data. In 5.5 years we have accessed Software77 servers about 2k times, while producing 74m+ answers on our own. We are actually relieving their servers of load. Jul 9 License changed to LGPLv3 making our service more usable. 2013 Oct 16 As IPv4 space comes close to its limit, we will deliver an IPv6 option soon. 2012 Jul 10 We are still here, no major hiccups in 2.5 years. Hope it serves your needs properly. 2011 2010 Jan 9 Core is redesigned and rebuilt from scratch. Databases are no longer in use, seems they were too bulky to operate. New solution features RAM-based indexed binary search. Update process has been reduced from over 60 minutes to under 10 seconds. This makes GeoLoc accurate within 2 hours after new data is published by Webnet77.com, instead of 17 hours as it was until yesterday. Jan 7 Starting 1 a.m. GMT something is really wrong. Out of 96 database update threads 34 crash during 31 hours' period. It means extreme overload generated by those other websites. Results in presumably over 30% incorrect answers by GeoLoc. 2009 Nov 22 ~ Dec 20 Server shows some strain from time to time. Not related to amount of requests, however. There are 80-90 other websites hosted virtually on the same machine as this service, they probably start getting more and more visitors - which results in shared overload. Sorry for the inconvenience. Sep 13 Added load distribution (4 parallel databases) If flooding takes place again, we will add automated blacklisting. This is public service after all. Sep 12 Server overwhelmed by some mad script from (France) 150,000 requests/day from a single IP is a bit too many. Anyone responsible for this - please revise your loops. Everyone - consider caching retrieved results for at least one day. 'Cookie' your clients wherever possible, IP data changes slowly enough to be updated just once a day. If you feel like killing your server with thousands of IPs per second, download a csv from <http://software77.net/geo-ip> Mar 14 GeoLoc.daiguo.com says Hello World! 2008
==== Accepted inputs: ============================================================================================================= http://ip2c.org/?ip=XXX.XXX.XXX.XXX or http://ip2c.org/XXX.XXX.XXX.XXX | + standard IPv4 from to + e.g. we take your IP: | + URL looks like this: http://ip2c.org/?ip= | or | http://ip2c.org/ | + resulting string is: 1;US;USA;United States http://ip2c.org/?dec=XXXXXXXXXX or http://ip2c.org/XXXXXXXXXX | + decimal number from 0 to 4294967295 (MAX_INT) + faster than ?ip= option, less server-side processing + to convert IPv4 to decimal you only need to know this: | + (IPv4) A.B.C.D == A*256^3 + B*256^2 + C*256 + D (decimal) + e.g. == 5*256^3 + 6*256^2 + 7*256 + 8 == 5*16777216 + 6*65536 + 7*256 + 8 == 83886080 + 393216 + 1792 + 8 == 84281096 http://ip2c.org/?self or http://ip2c.org/self or http://ip2c.org/s | + processes caller's IP + faster than ?dec= option but limited to one purpose - give info about yourself Caution Some clients (e.g. ASP) may have issues while trying to open a file over HTTP. In that case a slash / preceding ?ip= is obligatory.
==== Possible outputs: ============================================================================================================ 0;;;WRONG INPUT | + your request has not been processed due to invalid syntax | + e.g. bad IPv4 like 300.400.abc.256 + e.g. bad decimal like 2a3b4c or bigger than MAX_INT 1;CD;COD;COUNTRY | + contains two-letter (ISO 3166) and three-letter country codes, and a full country name + country name may be multi-word and contain spaces + e.g. we take your IP: | + URL looks like this: http://ip2c.org/?ip= | or | http://ip2c.org/ | + resulting string is: 1;US;USA;United States 2;;;UNKNOWN | + given ip/dec not found in database or not yet physically assigned to any country The first digit indicates status so you don't have to always parse the whole string. Output is always semicolon delimited text/plain - you can pass it to any type of application.
==== PHP example: ================================================================================================================= $ip = ''; //or any other IP here $s = file_get_contents('http://ip2c.org/'.$ip); switch($s[0]) { case '0': echo 'Something wrong'; break; case '1': $reply = explode(';',$s); echo '<br>Two-letter: '.$reply[1]; echo '<br>Three-letter: '.$reply[2]; echo '<br>Full name: '.$reply[3]; break; case '2': echo 'Not found in database'; break; }
==== Java example: ================================================================================================================ String ip = ""; //or any other IP here HttpURLConnection urlcon = (HttpURLConnection)new URL("http://ip2c.org/"+ip).openConnection(); urlcon.setDefaultUseCaches(false); urlcon.setUseCaches(false); urlcon.connect(); InputStream is = urlcon.getInputStream(); int c = 0; String s = ""; while((c = is.read()) != -1) s+= (char)c; is.close(); switch(s.charAt(0)) { case '0': System.out.println("Something wrong"); break; case '1': String[] reply = s.split(";"); System.out.println("Two-letter: " + reply[1]); System.out.println("Three-letter: " + reply[2]); System.out.println("Full name: " + reply[3]); break; case '2': System.out.println("Not found in database"); break; }
==== License: ===================================================================================================================== This service is provided FREE under the terms of the GNU LGPLv3, 29 June 2007 <http://www.gnu.org/copyleft/lesser.html> This means the service is provided "as is". There is NO WARRANTY WHATSOEVER for the service. Use at your own risk.
==== Notes: ======================================================================================================================= This service uses IP to Country Database maintained by Webnet77.com <http://Webnet77.com/contact.html> <http://software77.net/geo-ip> You may contact the author of this service at <mail at ip2c dot org>
==== Statistics: (2014 Oct 23, 08:00 UTC+2) ===================================================================================== 437,948,495 requests processed since 2008 Mar 14 22,546 last hour 6/s ~2% of server load capacity 810,707 yesterday 5,004,962 last 7 days average 4,237,205 last 30 days average Graphs: 2008 2009 2010 2011 2012 2013 zoomed 2013 2014 30 days
==== (c)2008-2014 ip2c.org (GeoLoc.daiguo.com) ====================================================================================
Hosted at home.pl - reliable Polish datacenter See for yourself: VPS & dedicated, hosting, domains
If you appreciate
this service -
send us a few coins!

Choose currency:

The Thank You List