Using Laravel, I can get the client IP with request()->ip()
.
Is there a Laravel built-in way to get the server IP? Or is it something "impossible" (same problem as SERVER_ADDR
reliability)
You can use request object:
request()->server('SERVER_ADDR');
Or you can use standard PHP way:
$_SERVER['SERVER_ADDR'];
Request::server('SERVER_ADDR')
:)
URL Reference: https://laravel.com/api/5.3/Illuminate/Http/Request.html
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