Smart-IP API: Documentation
SmartIP Object
To create an instance of SmartIP object use "new" operator:
var myIp = new SmartIP();
Methods
load( ip)
Implements loading data from Smart-IP.net web-service.
Parameters: ip — a string containing IP-address, for example '213 .198.27.124'.
This option is not mandatory.
When parameter is not set IP-address will be detected automatically.
After loading data this method initializes "onload" and "onafterload" events.
Any time you use a getter-methods you should to call load() before them (the better way is to use getter-methods inside "onload" or "onafterload" events). For example:
var MyIP = new SmartIP();
MyIP.load();
MyIP.onload = function() {
alert( MyIP.getCountryName()); // in this case instead of MyIP
// you can use "this" operator
}
getIp()
Returns IP-address.
getHostname()
Returns hostname for the current IP-address.
getCity()
Returns name of the city to which the IP address assigned in the current version of geo-data.
getCountryCode()
Returns 2-chars country code (in upper case) to which IP address is assigned in the current version of geo-data.
getCountryName()
Returns name of the country to which IP address is assigned in the current version of geo-data.
getRegion()
Returns the name of the region to which the IP address is assigned in the current version of geo-data.
getLatitude()
Returns latitude coordinates of IP-addresses in the current version of geo-data.
getLongitude()
Returns longitude coordinates of IP-addresses in the current version of geo-data.
getProxyIp()
Returns address of a proxy server (this method will return data only in the case of a proxy server used by user, and IP address was detected automatically).
isUaIx()
Informs whether the current IP-address is on the list of networks of UA-IX (1 - true, 0 - false).
getLongIp()
Returns integer representation of the current IP-address.
getReverseIp()
Returns reversible IP against the current.
getBrowser()
Returns name and version of the browser (valid only in cases of automatic detection of IP).
getOs()
Returns user's operating system name (valid only in cases of automatic detection of IP).
getUserAgent()
Returns full header record of USER_AGENT, sent by browser (valid only in cases of automatic detection of IP).
getWhoisNetRange()
Returns range of IP addresses for the current network of IP-address. The source of this information is WHOIS service.
getWhoisNetName()
Returns network name for the current IP-address. The source of this information is WHOIS service.
getWhoisNetDescr()
Returns network description for the current IP-address. The source of this information is WHOIS service.
getWhoisCountryCode()
Returns 2-chars country code (in upper case) for the current IP-address. The source of this information is WHOIS service.
getWhoisAddress()
Returns address of the network provider for the current IP-address. The source of this information is WHOIS service.
getWhoisNetAdmin()
Returns the name of administrator of network for the current IP-address. The source of this information is WHOIS service.
getWhoisTextRecord()
Returns full text of WHOIS response for the current IP-address. The source of this information is WHOIS service.
Events
onbeforeload
This event occurs before the start loading data.
onload
This event occurs immediately after the data has been loaded.
onafterload
This event occurs after the data has been loaded and when the "onload" event has been completed.

