Q
|
I have several IP addresses already stored in my database. Can I use CountryHawk to look up the country information for these IPs?
|
A
|
Yes, you simply use its Initialize method like this:
ch = Server.CreateObject("cyScape.CountryObj")
for each IP in db
ch.Initialize IP
thisDBRecordsCountry = ch.CountryCode
next
Keep in mind, though, that IP addresses do get reassigned over time. Therefore, it is important that you use CountryHawk to look up the information before too much time has passed (say, within 30-60 days). For example, 212.12.10.5 may have been assigned to a company in France three months ago, but if it was recently assigned to a US company, CountryHawk will return the code as US.
Also, on a related note, there is a more efficient way to store IP addresses in a database. See the StringIPToLong Method in the CountryHawk documentation.
|