Saturday, 21 September 2013

Find country name and city using ip address in php

Hello Friends use this code for get

$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]));
 $countrycode = stripslashes(ucfirst($addr_details[geoplugin_countryCode]));
 $country = stripslashes(ucfirst($addr_details[geoplugin_countryName]));

1 comment:

  1. I think your blog has some good information php development . I found some useful information which definitely helps in future.
    hire php developers | wordpress development Agency

    ReplyDelete