If you are developing and thus connecting local that's the IP you're probably connecting with to your local webserver.
Nov 16, 2017
9
Level 1
Get Client IP address
Hello! Im a trying to get client IP address but it is returning only my localhost server address(127.0.0.1)
Here is my code:
public function ip(Request $request)
{
$ip= Request::getClientIp();
$data = Location::get($ip);
dd($data,$ip);
}
I have also tried this one:
public function ip(Request $request)
{
$ip= \Request::ip();
$data = Location::get($ip);
dd($data,$ip);
}
But im still getting the same result (127.0.0.7) which is my localhost address and not my Ip address.
Please I need help
Level 17
It will get the client public IP. Run it on a live server and see the results. You'll see your own public IP pop up.
Please or to participate in this conversation.