This method returns the 2-letter country code for the given IP address. It works with both the free and the non-free databases.
Example 54-1. Looking up the country code
string $addr - IP address
Note: Hostnames are not supported. More information.
This method throws an exception if the IP address is invalid or if the database type is incorrect.