jistanidiot Posted July 17, 2023 Share Posted July 17, 2023 I know I can use $_SERVER['REMOTE_ADDR'] to get a user's IP address. However that only gives either the IPv4 or the IPv6 address, not both. I've seen sites that will give you both. I'm wondering how to get both with PHP. Is it some simple function I just don't know about or does it require some complex actions (If it requires something complex just point me in the right direction to get started)? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted July 18, 2023 Solution Share Posted July 18, 2023 The way they do it is they give the user something to connect to that supports only IPv4, and then another that supports only IPv6. Then they combine the information together to give you the full results. Because all you can ever get from the user is how they connected to your site. If they used IPv4 then you can't know what their (public) IPv6 address is. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.