Created
October 5, 2021 12:13
-
-
Save Draknek/0b7e1f14fc37cce41f2cab81b8e8a850 to your computer and use it in GitHub Desktop.
Redirect to region-specific Switch storepage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ip = $_SERVER['REMOTE_ADDR']; | |
try { | |
$ip_data = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); | |
if ($ip_data->geoplugin_continentCode == 'EU') // Europe | |
{ | |
header('Location: https://www.nintendo.co.uk/Games/Nintendo-Switch-download-software/Bonfire-Peaks-2041254.html'); | |
exit; | |
} | |
else if ($ip_data->geoplugin_continentCode == 'OC') // Oceania | |
{ | |
header('Location: https://ec.nintendo.com/AU/en/titles/70010000044714'); | |
exit; | |
} | |
else if ($ip_data->geoplugin_countryCode == 'JP') // Japan | |
{ | |
header('Location: https://store-jp.nintendo.com/list/software/70010000044721.html'); | |
exit; | |
} | |
} | |
catch (Exception $e) | |
{ | |
// oh well | |
} | |
// Fall back to Americas | |
header('Location: https://www.nintendo.com/games/detail/bonfire-peaks-switch/'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment