First, ordinary IP is unable to obtain detailed latitude and longitude, only through network services to obtain
The most useful in China is the JavaScript API provided by www.ip-look-up.com, as long as the following statements are written in the Web page
<script type= "Text/javascript" src= "Http://www.ip-look-up.com/Services/ipInfo.js" ></script>
He's going to return a JSON data in memory, just a little bit.
iplocation = {' Latitude ': 39.9289, ' longitude ': 116.388, ' address ': {' city ': ' Beijing ' , ' Region ': ' Beijing ', ' country ': ' in ', ' cnregionname ': ', ' cncity ': ', ' cncountryname ': ', ' country_code ': ' CN '};
There is also a webservice provided by http://www.fraudlabs.com/, which returns XML
As long as the user registered in his page to obtain the authorization of the key, and then download the corresponding programming language provided by the functional class will be able to resolve the location of the incoming IP
Modify the corresponding content in Client.java Java don't forget to refer to a few of the necessary jar packs (Mail.jar,soap.jar,xercesimpl.jar,xml-apis.jar,xmlparserapis.jar)
public class Client
{//entry point to this
application public
static void Main (string[] args)
{
try
{
//create a proxy
apachesoapproxy proxy = new Apachesoapproxy ();
Invoke Fraudlabscheck () over SOAP and get the new OID
//require Parameter fraudlabscheck (String IP, String LICENSE) c10/>string result = Proxy. Fraudlabs ("148.229.0.123", "xx-xxxx-xxxx");
Print out of the value
System.out.println (result);
}
catch (Java.net.MalformedURLException exception)
{
exception.printstacktrace ();
}
catch (Org.apache.soap.SOAPException exception)
{
exception.printstacktrace ();
}
}
}