I have seen this asked before, but I haven't been able to use those answers to get the IP address of the user.
in PHP it would be this:
$_SERVER['REMOTE_ADDR'];
If you need to access this information within an action:
Action { request =>
val address = request.remoteAddress;
...
}
If you need the access somewhere else, note that you can use implicit:
Action { implicit request => ... }
myMethod(implicit request: Request) { ... }
And you can always fall back to just passing the request around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With