Friday 15 November 2013

Get Visitor Info Using Their IP Address

funtion getVisitorInfo($userip,$output){
        $result  = "Unknown";     
        $url =  "http://www.geoplugin.net/json.gp?ip=".$ip;
        $data = file_get_contents($url);  
        $ip_data = @json_decode($data);
        if($ip_data && $ip_data->$output != null)
        {
           $result = $ip_data->$output;
        }
        return $result;
}
$userip = $_SERVER['REMOTE_ADDR'];
//Get Country Name
$userCountryName = getVisitorInfo($userip,'geoplugin_countryName');
 //Get Country Code
$userCountryCode = getVisitorInfo($userip,'geoplugin_countryCode'); 


Below is list of infromation can be get from user ip.
geoplugin_request,
geoplugin_status,
geoplugin_credit,
geoplugin_city,
geoplugin_region,
geoplugin_areaCode,
geoplugin_dmaCode,
geoplugin_countryCode,
geoplugin_countryName,
geoplugin_continentCode,
geoplugin_latitude,
geoplugin_longitude,
geoplugin_regionCode,
geoplugin_regionName,
geoplugin_currencyCode,
geoplugin_currencySymbol,
geoplugin_currencySymbol_UTF8,
geoplugin_currencyConverter

Note:You need to allow allow_url_fopen in your php.ini config file.

No comments:

Post a Comment

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...