Potiomkin.com

Valid XHTML 1.0 Transitional

Valid CSS!

GEO project

Sorry, due to robot abuse this service is off. I'm working on new version of service.

GEO project is a 100% free ip to geo web Service. You can use it for tracking your user ip address, latitude, longitude, city, region, country. You can use this information for enriching your visitor's web experience by showing relevant and localized content, filling out forms automatically and using it with Google or Yahoo Maps web services. Or you can use it for logging and tracking information for your own analytics. By using this service you automatically agree to following terms and conditions

  1. This service will not work for mobile positioning. To do this you need client side software.
  2. Service accuracy is city level. Read about accuracy

GEO Widget

Width: px. (80 - 1000)

Height: px. (80 - 1000)



Your Code:

Geo project database

Description

This web service is powered by GeoLite data created by MaxMind, available from http://maxmind.com. And provides over 99.3% accuracy on a country level and 69% on a city level for the US within a 25 mile radius. More details.

Last updated

May 2008. Database is apdated on monthly basis.

Geo project API

Current version

0.8.1
New in 0.8.1:

  1. Fixed bug with recognition of IP when client uses internal Proxy servers
  2. New parameter warning returned if client uses internal Proxy server
  3. Json mime-type changed from text/plain to application/json

This Service is being tested now.

Description

http://geo.potiomkin.com/get.php
[?ip=ip_address[&res=csv|xml|json|ue|gimg[&gis=heightxwidth|size[&gll=on]]]]

Parameters

Parametr Description
ip Is an optional parameter . You can pass a standard format address. If not set server will try to grab ip address by itself.
res Optional parameter. To chose a format of data returned for easy of use with your application

csv – returns data in coma separated value text format. Default

mime-type: text/plain

Result sample: 
'70.73.XX.XXX','Canada','AB','Calgary',51.0833,-114.0833

Error sample:
Error: IP Address you entered 1234 is not valid.

xml – returns data in xml format.

mime-type: text/xml

Result sample:
<?xml version="1.0" encoding="utf-8"?>
<respond>
    <ip>70.73.XX.XXX</ip>
    <country>Canada</country>
    <region>AB</region>
    <city>Calgary</city>
    <latitude>51.0833</latitude>
    <longitude>-114.0833</longitude>
</respond>

Error sample:
<?xml version="1.0" encoding="utf-8"?>
<respond>
    <error>IP Address you entered 1234 is not valid.</error>
</respond>

json – returns data in Json format for easy use with your javascript (AJAX) application.

mime-type: application/json

Result sample:
{
'respond':
	{
    	'ip':'70.73.XX.XXX',
        'country':'Canada',
        'region':'AB',
        'city':'Calgary',
        'latitude':51.0833,
        'longitude':-114.0833
      }
}

Error sample:
{
'respond':
	{
		'error':'IP Address you entered 1234 is not valid.'
	}
}

ue – returns data in form url encoded format for easy use with Adobe Flash (Action Script)

mime-type: application/x-www-form-urlencoded

Result sample:
ip=70.73.XX.XXX&country=Canada&region=AB/
&city=Calgary&latitude=51.0833&longitude=-114.0833

Error sample:
error=IP+Address+you+entered+1234+is+not+valid.

gimg* – Returns data as google maps static image.

mime-type: text/html

It returns image as part of HTML code to implement it to your page. You can use fallowing HTML code.

<iframe width="150" height="150" scrolling="no"
src="http://geo.potiomkin.com/get.php?res=gimg"></iframe>
gis * Google image size. Works only with res=gimg. Default size 150x150px.

HeightxWidth – Height and width of image returned. Height and width of image returned. Minimal size is 80px maximal 1000px.

http://geo.potiomkin.com/get.php?res=gimg&gis=200x300
Will return image 200 pixels wide and 300px high.

size - You can set just one dimension. In this case image returned will be square.

http://geo.potiomkin.com/get.php?res=gimg&gis=200
Will return image 200 pixels wide and 200px high.
gll * If set to "on" uses google to get longitude and latitude based on «country region city» Search. Works only with res=gimg.
* - This parts of Service perform requests to Goole Maps Service, and could be performed faster on your server using Google Maps API.

Code samples

PHP 

<?php
/*Using curl library*/ 
  $ch = curl_init();
  $url = "http://geo.potiomkin.com/get.php?res=csv";
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_FAILONERROR, 1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
  $r = curl_exec($ch);
  $r = explode(",",$r);
  print_r($r);					
?>

It will output:

Array
(
    [0] => '66.xx.xx.xx' // IP address
    [1] => 'United States' // Country
    [2] => 'MA' // Region
    [3] => 'Burlington' // City 
    [4] => 42.5051 // Latitude
    [5] => -71.2047 // Longitude
)

Javascript 

var xmlHttp;

/*This function creates  browser independent XmlHttpRequest object*/
function GetXmlHttpObject(){
var xmlHttp=null;
try{xmlHttp=new XMLHttpRequest();}
catch (e){
 try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
 catch (e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
};

var jsonObject;
var http_request =  GetXmlHttpObject();
var url = "http://geo.potiomkin.com/get.php?res=csv";
http_request.open( "GET", url, true );
http_request.onreadystatechange = function () {
    if ( http_request.readyState == 4 ) {
        if ( http_request.status == 200 ) {
            jsonObject = eval( "(" + http_request.responseText + ")" );
            alert(jsonObject.respond.country);
        } else {
            alert( "There was a problem with the URL." );
        }
        http_request = null;
    }
};

This code should alert country name.

Actionscript

obj.onLoad=function(){
	this.loadVariables("http://geo.potiomkin.com/get.php?res=ue",'GET'); 
}

Now obj have properties: country, region etc.

Coldfusion

<CFHTTP URL="http://geo.potiomkin.com/get.php?res=xml"
	METHOD="GET" resolveurl="Yes"></CFHTTP>
<cfset xml_str=cfhttp.filecontent>

Now xml_str is string with xml in it so you can parce it.

Java

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class RequestMaker {
	public static void main(String[] args) throws Exception {
		URL u = new URL("http://geo.potiomkin.com/get.php?res=xml");
		HttpURLConnection connection = (HttpURLConnection) u.openConnection();
		connection.connect();
		InputStream in = connection.getInputStream();
		StringBuffer response = new StringBuffer();
		int nextByte;
		while ((nextByte = in.read()) != -1)
			response .append((char) nextByte);
		in.close();
		System.out.println("Result: ");
		System.out.println(response .toString());
	}
}

Thanks to Ravi Ambros Wallau for this code.