You are here:

ActiveXperts.com > Network Component > Objects > IPtoCountry
ActiveXperts Network Component

Quicklinks

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

On ftp.activexperts-labs.com, you can find a lot of Network Component samples. These samples are also part of the Network Component installation.

Visit ftp.activexperts-labs.com