is there a way to detect to IP Address of my client then use this to track his timezone.. iam currently using this block of code together with an API:
function getIpAddress() {
return (empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']);
}
ini_set("allow_url_fopen",1);
$getfunc= 'getIpAddress';
$getfunc= 'getIpAddress';
$json = file_get_contents('http://smart-ip.net/geoip-json/'.$ip);
$ipData = json_decode( $json, true);
$ipadd = $ipData['host'];
$geotz = $ipData['timezone'];
$geotzd = 'Passed';
$cntry = $ipData['countryName'];
the $ip returns 122.54.230.162. but still sayin that my problem is
Message: Undefined index: timezone
testing it on the server will show this error while it is okay on local.. i need help
best regards..