Hello, is there any way to know with C2 in which country the user is located?
This is for connecting to a suitable region in online mode with photon.
If you host a webserver with a PHP somewhere, you could perform an Ajax request to that file, with some PHP code that replies the country code.
Example php file content:
<?php $ip = $_SERVER['REMOTE_ADDR']; $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}")); echo $details->country; ?>
The code uses a free service from IP info, should still work. (Been around for years)
Thanks for the answer, I have no idea how to do that, is not there another easier way ?.
I think it would be best to show a graphic and that the player choose his region.
Develop games in your browser. Powerful, performant & highly capable.
Yeah I do that too.
Just have the selection append a variable to the game or room name before connecting.