Welcome to WebmasterWorld Guest from 54.196.244.186

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Redirecting page using IP address from US

     
12:37 am on Jan 5, 2005 (gmt 0)

New User

10+ Year Member

joined:Oct 9, 2003
posts:13
votes: 0


I know it is possible, I want to redirect the visitors from US by their IP address to a specific page. Which technology to use to identify IP with location
9:29 am on Jan 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 20, 2002
posts:889
votes: 0


I've not found a service that allows me to geolocate using IP (although like you I have seen other sites do it).

One option I have used is Javascript to pick up timezone from the browser and serve US specific ads to them - luckily enough I don't need to differentiate between North and South AMerica

6:56 pm on Jan 16, 2005 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts:2886
votes: 1


There are database sold which can be used to translate IP address to country, city, ISP etc. You could try one of these. You will need a mySQL database in most cases.

You can find these databases with a Google query like "ip country database" or "geo-targeting".

5:06 am on Jan 17, 2005 (gmt 0)

New User

10+ Year Member

joined:Dec 13, 2004
posts:33
votes: 0


The simple, extremely basic way:


<a href="http://USserver/">Click here</a> for US website

Otherwise, you need server-side scripting (PHP or ASP) and to rent an IP to location database.

Search IP to location on Google.

For an in-between solution, without a database but with a lot of unknown/misread locations, search for rWhois Country on Google.

10:06 pm on Jan 17, 2005 (gmt 0)

New User

10+ Year Member

joined:Oct 9, 2003
posts:13
votes: 0

well thanks to Orbite. I found this php code which i put for others as well here.

<?php

$ip = "62.253.132.86"; // Specify address to find country
// $ip = $_SERVER['REMOTE_ADDR']; // Uncomment to track referer country

################################################
# rWhois Country - Craig Donnelly
# craig@evilwalrus.com craig@develop3r.net
#
# Original Script Thanks:
#
# ** rWhois - Joel De Gan
# ** http://www.joihost.com, http://www.tenshimedia.com
#
# ** see http://www.rwhois.net/ for more information
#
# ** inputs: IP address
# ** outputs: array of rWhois info from first referral
# ** for other scripts see http://jabba.intercosmos.net
#
# SEE http://www.evilwalrus.com/viewcode/575.php
################################################

function rwhois($query){
$fp = fsockopen ("rwhois.arin.net", 4321, $errno, $errstr, 30);
if (!$fp) {
$ret[] = "$errstr ($errno)\n";
}else{
fputs ($fp, "$query\r\n\r\n"[smilestopper]);

$count=1;
while (!feof($fp) && $count < 17) {
$back = fgets ($fp,128);
$data = explode(":",$back);
$ret[$data[1]] = $data[2];
$count++;
}

fclose ($fp);
}
return $ret;
}

$cLook = rwhois($ip);

$host = gethostbyaddr($ip);
$ccode = strtolower(trim($cLook['Country-Code']));

switch($ccode)
{
case "ac": $country = "Ascension Island"; break;
case "ad": $country = "Andorra"; break;
case "ae": $country = "United Arab Emirates"; break;
case "af": $country = "Afghanistan"; break;
case "ag": $country = "Antigua and Barbuda"; break;
case "ai": $country = "Anguilla"; break;
case "al": $country = "Albania"; break;
case "am": $country = "Armenia"; break;
case "an": $country = "Netherlands Antilles"; break;
case "ao": $country = "Angola"; break;
case "aq": $country = "Antarctica"; break;
case "ar": $country = "Argentina"; break;
case "as": $country = "American Samoa"; break;
case "at": $country = "Austria"; break;
case "au": $country = "Australia"; break;
case "aw": $country = "Aruba"; break;
case "az": $country = "Azerbaijan"; break;
case "ba": $country = "Bosnia and Herzegovina"; break;
case "bb": $country = "Barbados"; break;
case "bd": $country = "Bangladesh"; break;
case "be": $country = "Belgium"; break;
case "bf": $country = "Burkina Faso"; break;
case "bg": $country = "Bulgaria"; break;
case "bh": $country = "Bahrain"; break;
case "bi": $country = "Burundi"; break;
case "bj": $country = "Benin"; break;
case "bm": $country = "Bermuda"; break;
case "bn": $country = "Brunei Darussalam"; break;
case "bo": $country = "Bolivia"; break;
case "br": $country = "Brazil"; break;
case "bs": $country = "Bahamas"; break;
case "bt": $country = "Bhutan"; break;
case "bv": $country = "Bouvet Island"; break;
case "bw": $country = "Botswana"; break;
case "by": $country = "Belarus"; break;
case "bz": $country = "Belize"; break;
case "ca": $country = "Canada"; break;
case "cc": $country = "Cocos (Keeling) Islands"; break;
case "cd": $country = "Congo, Democratic Republic of the"; break;
case "cf": $country = "Central African Republic"; break;
case "cg": $country = "Congo, Republic of"; break;
case "ch": $country = "Switzerland"; break;
case "ci": $country = "Cote d'Ivoire"; break;
case "ck": $country = "Cook Islands"; break;
case "cl": $country = "Chile"; break;
case "cm": $country = "Cameroon"; break;
case "cn": $country = "China"; break;
case "co": $country = "Colombia"; break;
case "cr": $country = "Costa Rica"; break;
case "cu": $country = "Cuba"; break;
case "cv": $country = "Cap Verde"; break;
case "cx": $country = "Christmas Island"; break;
case "cy": $country = "Cyprus"; break;
case "cz": $country = "Czech Republic"; break;
case "de": $country = "Germany"; break;
case "dj": $country = "Djibouti"; break;
case "dk": $country = "Denmark"; break;
case "dm": $country = "Dominica"; break;
case "do": $country = "Dominican Republic"; break;
case "dz": $country = "Algeria"; break;
case "ec": $country = "Ecuador"; break;
case "ee": $country = "Estonia"; break;
case "eg": $country = "Egypt"; break;
case "eh": $country = "Western Sahara"; break;
case "er": $country = "Eritrea"; break;
case "es": $country = "Spain"; break;
case "et": $country = "Ethiopia"; break;
case "fi": $country = "Finland"; break;
case "fj": $country = "Fiji"; break;
case "fk": $country = "Falkland Islands (Malvina)"; break;
case "fm": $country = "Micronesia, Federal State of"; break;
case "fo": $country = "Faroe Islands"; break;
case "fr": $country = "France"; break;
case "ga": $country = "Gabon"; break;
case "gd": $country = "Grenada"; break;
case "ge": $country = "Georgia"; break;
case "gf": $country = "French Guiana"; break;
case "gg": $country = "Guernsey"; break;
case "gh": $country = "Ghana"; break;
case "gi": $country = "Gibraltar"; break;
case "gl": $country = "Greenland"; break;
case "gm": $country = "Gambia"; break;
case "gn": $country = "Guinea"; break;
case "gp": $country = "Guadeloupe"; break;
case "gq": $country = "Equatorial Guinea"; break;
case "gr": $country = "Greece"; break;
case "gs": $country = "South Georgia and the South Sandwich Islands"; break;
case "gt": $country = "Guatemala"; break;
case "gu": $country = "Guam"; break;
case "gw": $country = "Guinea-Bissau"; break;
case "gy": $country = "Guyana"; break;
case "hk": $country = "Hong Kong"; break;
case "hm": $country = "Heard and McDonald Islands"; break;
case "hn": $country = "Honduras"; break;
case "hr": $country = "Croatia/Hrvatska"; break;
case "ht": $country = "Haiti"; break;
case "hu": $country = "Hungary"; break;
case "id": $country = "Indonesia"; break;
case "ie": $country = "Ireland"; break;
case "il": $country = "Israel"; break;
case "im": $country = "Isle of Man"; break;
case "in": $country = "India"; break;
case "io": $country = "British Indian Ocean Territory"; break;
case "iq": $country = "Iraq"; break;
case "ir": $country = "Iran (Islamic Republic of)"; break;
case "is": $country = "Iceland"; break;
case "it": $country = "Italy"; break;
case "je": $country = "Jersey"; break;
case "jm": $country = "Jamaica"; break;
case "jo": $country = "Jordan"; break;
case "jp": $country = "Japan"; break;
case "ke": $country = "Kenya"; break;
case "kg": $country = "Kyrgyzstan"; break;
case "kh": $country = "Cambodia"; break;
case "ki": $country = "Kiribati"; break;
case "km": $country = "Comoros"; break;
case "kn": $country = "Saint Kitts and Nevis"; break;
case "kp": $country = "Korea, Democratic People's Republic"; break;
case "kr": $country = "Korea, Republic of"; break;
case "kw": $country = "Kuwait"; break;
case "ky": $country = "Cayman Islands"; break;
case "kz": $country = "Kazakhstan"; break;
case "la": $country = "Lao People's Democratic Republic"; break;
case "lb": $country = "Lebanon"; break;
case "lc": $country = "Saint Lucia"; break;
case "li": $country = "Liechtenstein"; break;
case "lk": $country = "Sri Lanka"; break;
case "lr": $country = "Liberia"; break;
case "ls": $country = "Lesotho"; break;
case "lt": $country = "Lithuania"; break;
case "lu": $country = "Luxembourg"; break;
case "lv": $country = "Latvia"; break;
case "ly": $country = "Libyan Arab Jamahiriya"; break;
case "ma": $country = "Morocco"; break;
case "mc": $country = "Monaco"; break;
case "md": $country = "Moldova, Republic of"; break;
case "mg": $country = "Madagascar"; break;
case "mh": $country = "Marshall Islands"; break;
case "mk": $country = "Macedonia, Former Yugoslav Republic"; break;
case "ml": $country = "Mali"; break;
case "mm": $country = "Myanmar"; break;
case "mn": $country = "Mongolia"; break;
case "mo": $country = "Macau"; break;
case "mp": $country = "Northern Mariana Islands"; break;
case "mq": $country = "Martinique"; break;
case "mr": $country = "Mauritania"; break;
case "ms": $country = "Montserrat"; break;
case "mt": $country = "Malta"; break;
case "mu": $country = "Mauritius"; break;
case "mv": $country = "Maldives"; break;
case "mw": $country = "Malawi"; break;
case "mx": $country = "Mexico"; break;
case "my": $country = "Malaysia"; break;
case "mz": $country = "Mozambique"; break;
case "na": $country = "Namibia"; break;
case "nc": $country = "New Caledonia"; break;
case "ne": $country = "Niger"; break;
case "nf": $country = "Norfolk Island"; break;
case "ng": $country = "Nigeria"; break;
case "ni": $country = "Nicaragua"; break;
case "nl": $country = "Netherlands"; break;
case "no": $country = "Norway"; break;
case "np": $country = "Nepal"; break;
case "nr": $country = "Nauru"; break;
case "nu": $country = "Niue"; break;
case "nz": $country = "New Zealand"; break;
case "om": $country = "Oman"; break;
case "pa": $country = "Panama"; break;
case "pe": $country = "Peru"; break;
case "pf": $country = "French Polynesia"; break;
case "pg": $country = "Papua New Guinea"; break;
case "ph": $country = "Philippines"; break;
case "pk": $country = "Pakistan"; break;
case "pl": $country = "Poland"; break;
case "pm": $country = "St. Pierre and Miquelon"; break;
case "pn": $country = "Pitcairn Island"; break;
case "pr": $country = "Puerto Rico"; break;
case "ps": $country = "Palestinian Territories"; break;
case "pt": $country = "Portugal"; break;
case "pw": $country = "Palau"; break;
case "py": $country = "Paraguay"; break;
case "qa": $country = "Qatar"; break;
case "re": $country = "Reunion Island"; break;
case "ro": $country = "Romania"; break;
case "ru": $country = "Russian Federation"; break;
case "rw": $country = "Rwanda"; break;
case "sa": $country = "Saudi Arabia"; break;
case "sb": $country = "Solomon Islands"; break;
case "sc": $country = "Seychelles"; break;
case "sd": $country = "Sudan"; break;
case "se": $country = "Sweden"; break;
case "sg": $country = "Singapore"; break;
case "sh": $country = "St. Helena"; break;
case "si": $country = "Slovenia"; break;
case "sj": $country = "Svalbard and Jan Mayen Islands"; break;
case "sk": $country = "Slovak Republic"; break;
case "sl": $country = "Sierra Leone"; break;
case "sm": $country = "San Marino"; break;
case "sn": $country = "Senegal"; break;
case "so": $country = "Somalia"; break;
case "sr": $country = "Suriname"; break;
case "st": $country = "Sao Tome and Principe"; break;
case "sv": $country = "El Salvador"; break;
case "sy": $country = "Syrian Arab Republic"; break;
case "sz": $country = "Swaziland"; break;
case "tc": $country = "Turks and Caicos Islands"; break;
case "td": $country = "Chad"; break;
case "tf": $country = "French Southern Territories"; break;
case "tg": $country = "Togo"; break;
case "th": $country = "Thailand"; break;
case "tj": $country = "Tajikistan"; break;
case "tk": $country = "Tokelau"; break;
case "tm": $country = "Turkmenistan"; break;
case "tn": $country = "Tunisia"; break;
case "to": $country = "Tonga"; break;
case "tp": $country = "East Timor"; break;
case "tr": $country = "Turkey"; break;
case "tt": $country = "Trinidad and Tobago"; break;
case "tv": $country = "Tuvalu"; break;
case "tw": $country = "Taiwan"; break;
case "tz": $country = "Tanzania"; break;
case "ua": $country = "Ukraine"; break;
case "ug": $country = "Uganda"; break;
case "uk": $country = "United Kingdom"; break;
case "um": $country = "US Minor Outlying Islands"; break;
case "us": $country = "United States"; break;
case "uy": $country = "Uruguay"; break;
case "uz": $country = "Uzbekistan"; break;
case "va": $country = "Holy See (City Vatican State)"; break;
case "vc": $country = "Saint Vincent and the Grenadines"; break;
case "ve": $country = "Venezuela"; break;
case "vg": $country = "Virgin Islands (British)"; break;
case "vi": $country = "Virgin Islands (USA)"; break;
case "vn": $country = "Vietnam"; break;
case "vu": $country = "Vanuatu"; break;
case "wf": $country = "Wallis and Futuna Islands"; break;
case "ws": $country = "Western Samoa"; break;
case "ye": $country = "Yemen"; break;
case "yt": $country = "Mayotte"; break;
case "yu": $country = "Yugoslavia"; break;
case "za": $country = "South Africa"; break;
case "zm": $country = "Zambia"; break;
case "zw": $country = "Zimbabwe"; break;

default: $country = "Unknown";

}

echo "<font face=\"verdana,arial,helvetica\" size=\"2\">The IP address given originates from <b>" . $country . "</b> (<font color=\"red\">$host</font>[smilestopper])</font>";

?>

11:06 pm on Jan 17, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 6, 2002
posts:191
votes: 0


The ip address is close to:
Mill Road
Cambridge
England
United Kingdom

GeorgeGG

GeoKen

2:01 am on Jan 21, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


Target Country by IP Address - IP address, country location and country based geotargeting detection and traffic redirection software.(Free PHP script)
[analysespider.com...]