Jump to content

getting both ipv4 and ipv6 address of user


Go to solution Solved by requinix,

Recommended Posts

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.  

  • Solution

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.