Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 317 → Rev 318

/belle2/masterclass/ip2coordinates.php
8,8 → 8,8
if($ipcheck == -1 || $ipcheck === false)
trigger_error('Invalid IP, what are you doing? :|', E_USER_ERROR);
else
 
$uri = 'http://freegeoip.net/json/' . $ip;
$key='482198dbcb57d1747babb7acebc5c02e';
$uri = 'http://api.ipstack.com/' . $ip . '?access_key=' . $key . '&output=json&legacy=1';
$json = file_get_contents($uri);
$data = json_decode($json, true);
$location = $data['country_name'];