GEOIP – Get Country by IP

function get_ip_info($ip){
	$api = 'http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=';
	$tags = get_meta_tags($api . $ip);
	return $tags;
}

Reference:

Response Tag Example:

<html>
<head>

<meta name="known" content="true">
<meta name="locationcode" content="TWTPTAIP">
<meta name="fips104" content="TW">
<meta name="iso2" content="TW">
<meta name="iso3" content="TWN">
<meta name="ison" content="158">
<meta name="internet" content="TW">
<meta name="countryid" content="236">
<meta name="country" content="Taiwan">
<meta name="regionid" content="4274">
<meta name="region" content="T'ai-pei">
<meta name="regioncode" content="TP">
<meta name="adm1code" content="TW03">
<meta name="cityid" content="6744">
<meta name="city" content="Taipei">
<meta name="latitude" content="25.0170">
<meta name="longitude" content="121.4500">
<meta name="timezone" content="+08:00">
<meta name="certainty" content="42">
<meta name="mapbytesremaining" content="Free">

<title>PHP2 Template</title>
</head>
<body></body>
</html>