<?php
$ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$country = trim(file_get_contents('http://api.hostip.info/country.php?ip='.$ip));
switch($country)
{
case 'UK':
header('Location: http://www.domain.co.uk');
break;
}
//Etc
?>