Reputation: 8726
I'm trying to get the client IP address using the code $_SERVER['REMOTE_ADDR']
.
When I tried to dd($_SERVER['REMOTE_ADDR'])
, it gives me the following output.
string '::1' (length=3)
What's the reason? Am I doing it wrong?
My target is to identify the user location based on the IP address and calling an external API.
Upvotes: 1
Views: 2596
Reputation: 36299
When you have a server on say your laptop, and you try to access it from the same laptop, the website sees it as it self and is represented in many different ways, and here are a few:
127.0.0.1
::1
localhost
To see the IP of your computer you can do the following:
Upvotes: 3