Code: Select all
<?php
function getLocation() {
$ip = $_SERVER['REMOTE_ADDR'];
$geo = file_get_contents("http://api.hostip.info/get_html.php?ip=$ip");
$results = urlencode($geo);
echo $results;
}
getLocation();
?>
Code: Select all
Country%3A+CANADA+%28CA%29%0ACity%3A+ST.+JOHN%27S%2C+NL%0AIP%3A+142.162.13.207%0A
Unfortunately my experience with PHP REGEX is little to none and I've tried hard to make this work before posting here but my attempts were unsuccessful
Any help would be greatly appreciated. Thanks