I'm looking for a way to determine what is the hemisphere of a user who is visiting a web page by using PHP code.
This question is similar to this JS question but using PHP.
I'm looking for a way to determine what is the hemisphere of a user who is visiting a web page by using PHP code.
This question is similar to this JS question but using PHP.
Based on this answer: https://stackoverflow.com/a/17864552/1427345
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
list($lat, $long) = explode(',', $details->loc);
if ($lat > 0)
echo 'Northern Hemisphere';
else
echo 'Southern Hemisphere';