BrowserHawk IQ now available! Click here for the full scoop!
Search:
Can I use CountryHawk to look up IP addresses already in a db?
Created: 4/26/2002    Updated: 6/27/2002
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.

    FAQ Home  |  Search FAQ  |  Show New Items  |  Ask a FAQ  |  Notify Me  |  Most Popular     
 
 
Copyright © 1994-2020 cyScape, Inc. All Rights Reserved. ()
ASP, ASP.NET, ColdFusion MX, CFMX, JSP, PHP