Create Function :
function ipInfo($ip) { if(isset($ip)) { $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); if($data['geoplugin_status'] == '200') { return $data; } else { echo "Bad request!, Error code is ".$data['geoplugin_status']; } } else { echo "IP is not set!"; } }
Result :
|
No comments:
Post a Comment