get city from IP is not working on remote server but it works in localhost. Does anyone have any better ideas for getting the city from this class? Sometimes the server remote addr displays this:
::1
Here is the code I'm using:
class iplocation{
public function ipgetCity(){
$ip=$_SERVER['REMOTE_ADDR'];
$addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=’',$ip));
$city = stripslashes(ucfirst($addr_details['geoplugin_city']));
return $city;
} }