bagder: curl-www ipwhere.pm,1.1,1.2

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www
In directory labb:/tmp/cvs-serv24532

Modified Files:
	ipwhere.pm 
Log Message:
TLD to country mapping added


Index: ipwhere.pm
===================================================================
RCS file: /cvsroot/curl/curl-www/ipwhere.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ipwhere.pm	14 Nov 2005 10:14:52 -0000	1.1
+++ ipwhere.pm	14 Nov 2005 12:32:28 -0000	1.2
@@ -242,6 +242,252 @@
 'er' => 'Africa',
  );
 
+my %tld2cntr =
+(
+"ad" => "Andorra",
+"ae" => "Arab Emirates",
+"af" => "Afghanistan",
+"ag" => "Antigua",
+"ai" => "Anguilla",
+"al" => "Albania",
+"am" => "Armenia",
+"an" => "Antilles",
+"ao" => "Angola",
+"aq" => "Antarctica",
+"ar" => "Argentina",
+"as" => "American Samoa",
+"at" => "Austria",
+"au" => "Australia",
+"aw" => "Aruba",
+"az" => "Azerbaijan",
+"ba" => "Bosnia & Herzegovina",
+"bb" => "Barbados",
+"bd" => "Bangladesh",
+"be" => "Belgium",
+"bf" => "Burkina Faso",
+"bg" => "Bulgaria",
+"bh" => "Bahrain",
+"bi" => "Burundi",
+"bj" => "Benin",
+"bm" => "Bermuda",
+"bn" => "Brunei",
+"bo" => "Bolivia",
+"br" => "Brazil",
+"bs" => "Bahamas",
+"bt" => "Bhutan",
+"bv" => "Bouvet",
+"bw" => "Botswana",
+"by" => "Belarus",
+"bz" => "Belize",
+"ca" => "Canada",
+"cc" => "Cocos",
+"cf" => "Central African",
+"cg" => "Congo",
+"ch" => "Switzerland",
+"ci" => "Cote D'Ivoire",
+"ck" => "Cook",
+"cl" => "Chile",
+"cm" => "Cameroon",
+"cn" => "China",
+"co" => "Colombia",
+"cr" => "Costa Rica",
+"cu" => "Cuba",
+"cv" => "Cape Verde",
+"cx" => "Christmas",
+"cy" => "Cyprus",
+"cz" => "Czech",
+"de" => "Germany",
+"dj" => "Djibouti",
+"dk" => "Denmark",
+"dm" => "Dominica",
+"do" => "Dominican Republic",
+"dz" => "Algeria",
+"ec" => "Ecuador",
+"ee" => "Estonia",
+"eg" => "Egypt",
+"eh" => "Western Sahara",
+"es" => "Spain",
+"et" => "Ethiopia",
+"fi" => "Finland",
+"fj" => "Fiji",
+"fk" => "Falkland",
+"fm" => "Micronesia",
+"fo" => "Faroe",
+"fr" => "France",
+"fx" => "Metropolitan",
+"ga" => "Gabon",
+"gb" => "Great Britain",
+"gd" => "Grenada",
+"ge" => "Georgia",
+"gf" => "Guiana",
+"gh" => "Ghana",
+"gi" => "Gibraltar",
+"gl" => "Greenland",
+"gm" => "Gambia",
+"gn" => "Guinea",
+"gp" => "Guadeloupe",
+"gq" => "Equatorial Guinea",
+"gr" => "Greece",
+"gt" => "Guatemala",
+"gu" => "Guam",
+"gw" => "Guinea-Bissau",
+"gy" => "Guyana",
+"hk" => "Hong Kong",
+"hm" => "Heard, Mc Donald",
+"hn" => "Honduras",
+"hr" => "Croatia",
+"ht" => "Haiti",
+"hu" => "Hungary",
+"id" => "Indonesia",
+"ie" => "Ireland",
+"il" => "Israel",
+"in" => "India",
+"io" => "Indian Ocean",
+"iq" => "Iraq",
+"ir" => "Iran",
+"is" => "Iceland",
+"it" => "Italy",
+"jm" => "Jamaica",
+"jo" => "Jordan",
+"jp" => "Japan",
+"ke" => "Kenya",
+"kg" => "Kyrgyzstan",
+"kh" => "Cambodia",
+"ki" => "Kiribati",
+"km" => "Comoros",
+"kn" => "Saint Kitts",
+"kp" => "North Korea",
+"kr" => "South Korea",
+"kw" => "Kuwait",
+"ky" => "Cayman",
+"kz" => "Kazakhstan",
+"la" => "Lao",
+"lb" => "Lebanon",
+"lc" => "Saint Lucia",
+"li" => "Liechtenstein",
+"lk" => "Sri Lanka",
+"lr" => "Liberia",
+"ls" => "Lesotho",
+"ls" => "Lesotho",
+"lt" => "Lithuania",
+"lu" => "Luxembourg",
+"lv" => "Latvia",
+"ly" => "Libyan",
+"ma" => "Morocco",
+"mc" => "Monaco",
+"md" => "Moldova",
+"mg" => "Madagascar",
+"mh" => "Marshall",
+"mk" => "Macedonia",
+"ml" => "Mali",
+"mm" => "Myanmar",
+"mn" => "Mongolia",
+"mo" => "Macau",
+"mp" => "Mariana",
+"mq" => "Martinique",
+"mr" => "Mauritania",
+"ms" => "Montserrat",
+"mt" => "Malta",
+"mu" => "Mauritius",
+"mv" => "Maldives",
+"mw" => "Malawi",
+"mx" => "Mexico",
+"my" => "Malaysia",
+"mz" => "Mozambique",
+"na" => "Namibia",
+"nc" => "New Caledonia",
+"ne" => "Niger",
+"nf" => "Norfolk",
+"ng" => "Nigeria",
+"ni" => "Nicaragua",
+"nl" => "Netherlands",
+"no" => "Norway",
+"np" => "Nepal",
+"nr" => "Nauru",
+"nt" => "Neutral Zone",
+"nu" => "Niue",
+"nz" => "New Zealand",
+"om" => "Oman",
+"pa" => "Panama",
+"pe" => "Peru",
+"pf" => "French Polynesia",
+"pg" => "Papua",
+"ph" => "Philippines",
+"pk" => "Pakistan",
+"pl" => "Poland",
+"pm" => "St. Pierre, Miquelon",
+"pn" => "Pitcairn",
+"pr" => "Puerto Rico",
+"pt" => "Portugal",
+"pw" => "Palau",
+"py" => "Paraguay",
+"qa" => "Qatar",
+"re" => "Reunion",
+"ro" => "Romania",
+"ru" => "Russia",
+"rw" => "Rwanda",
+"sa" => "Saudi Arabia",
+"sb" => "Solomon",
+"sc" => "Seychelles",
+"sd" => "Sudan",
+"se" => "Sweden",
+"sg" => "Singapore",
+"sh" => "St. Helena",
+"si" => "Slovenia",
+"sj" => "Svalbard",
+"sk" => "Slovakia",
+"sl" => "Sierra Leone",
+"sm" => "San Marino",
+"sn" => "Senegal",
+"so" => "Somalia",
+"sr" => "Suriname",
+"st" => "Sao Tome, Principe",
+"su" => "USSR",
+"sv" => "El Salvador",
+"sy" => "Syria",
+"sz" => "Swaziland",
+"tc" => "Turks, Caicos",
+"td" => "Chad",
+"tf" => "Southern",
+"tg" => "Togo",
+"th" => "Thailand",
+"tj" => "Tajikistan",
+"tk" => "Tokelau",
+"tm" => "Turkmenistan",
+"tn" => "Tunisia",
+"to" => "Tonga",
+"tp" => "East Timor",
+"tr" => "Turkey",
+"tt" => "Trinidad",
+"tv" => "Tuvalu",
+"tw" => "Taiwan",
+"tz" => "Tanzania",
+"ua" => "Ukraine",
+"ug" => "Uganda",
+"uk" => "United Kingdom",
+"um" => "Minor Outlying",
+"us" => "United States",
+"uy" => "Uruguay",
+"uz" => "Uzbekistan",
+"va" => "Vatican",
+"vc" => "Saint Vincent, Grenadines",
+"ve" => "Venezuela",
+"vg" => "British Virgin",
+"vi" => "US Virgin",
+"vn" => "Vietnam",
+"vu" => "Vanuatu",
+"wf" => "Wallis and Futuna Islands",
+"ws" => "Samoa",
+"ye" => "Yemen",
+"yt" => "Mayotte",
+"yu" => "Yugoslavia",
+"za" => "South Africa",
+"zm" => "Zambia",
+"zr" => "Zaire",
+"zw" => "Zimbabwe",
+"er" => "Eritria",
+ );
+
 sub mycountry {
     my ($ip)=@_;
     my @o=`/home/dast/bin/ipwhere $ip`;
@@ -268,4 +514,11 @@
     return $tld2cont{lc($tld)};
 }
 
+# convert a two-letter TLD to a full text country string
+sub tld2country {
+    my ($tld)=@_;
+
+    return $tld2cntr{lc($tld)};
+}
+
 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.