In this laravel tutorial, I will tell you how to get an IP address from a request in Laravel.
Sometime we may require to get the client IP address from request object in our laravel application. In core PHP you can get from $_SERVER, but Laravel framework provides a very simple easy way to get client IP address from request.
Here, bellow I gave you an example of how you can get an IP address from a request. you can achieve this in Laravel by using request facade and helper:
Example 1:
$clientIP = \Request::ip();
Example 2:
$clientIP = \Request::getClientIp(true);
Example 3:
$clientIP = request()->ip();
Example 4:
public function ipaddress(Request $request)
{
print_r($request->ip());
}
If you found this article helpful please comment below. See also our tutorial on How to integrate a third party API in WordPress and How to integrate adobe echo sign API in Laravel.
Error: TypeError: Cannot read property map of undefined at resolveDependencies (C:\xampp\htdocs\reactnative\reactnativerealm\drug\node_modules\metro\src\DeltaBundler\traverseDependencies.js
How to get data in DESC order Realm React Native
How to integrate Binect APIs in php
How to delete table in Laravel?