ActiveXperts Network Component IPtoCountry Object
Today there are millions of internet users around the world. There are also numerous products and services available on the internet.
There are some key benefits of determines the country by IP address:
- Marketing - adapt your business, web content or language according to the geographic location of the visitor;
- Restrict access - restrict software or sites for users, based on the geographic location of the visitor;
- Web server log analysis - restrict software or sites for users, based on the geographic location of the visitor;
- Reduce credit card fraud.
The IPtoCountry object translates IP address to countries.
The IPtoCountry object is part of the Network Component. Overview of all Network Component objects:
DnsServer & DnsRecord - Ftp & FtpFile - Http - Icmp - IPtoCountry - Msn - Ntp - Radius - Rsh - Scp - SFtp - Ssh - SnmpManager - SnmpTrapManager - SnmpMibBrowser - Tcp - Tftp - TraceRoute - Udp - Xen - Wake-on-LAN - Xen (Citrix)
IPtoCountry Sample code
VBScript sample: convert a hostname to the associated country
Set objIPC = CreateObject("ActiveXperts.IPtoCountry") ' Create a new IPtoCountry instance
objIPC.Host = "www.activexperts.com" ' Host/IP to resolve
objIPC.Query() ' Query
WScript.Echo "Query, result: " & objIPC.LastError ' Result of Query; 0 means: success
If objIPC.LastError = 0 Then
WScript.Echo "Host " & strHost & " is located in " & objIPC.CountryName
End If
You can download the full samples here.
