Jump to content

Request for Support: Retrieving Both IPv4 and IPv6 Visitor IP Addresses


Recommended Posts

Posted


To Whom It May Concern

I am using VPS133 to study PHP programming.
I have encountered an issue while developing a PHP application. When I try to retrieve a visitor's IP address, my code only returns the IPv6 address. However, I need to obtain both the IPv4 and IPv6 addresses (when available).
Could you please advise whether this is related to the server or network configuration, and let me know if there is a way to retrieve both IPv4 and IPv6 addresses from visitors?
Your assistance would be greatly appreciated.
Thank you for your support.
Kind regards

Chakkrapong

Posted

I assume you're using $_SERVER['REMOTE_ADDR'] to get this value...if both the server and the visiting device support IPv6, it's typically going to be preferred. PHP can only see the IP of the connection used to call the script, so if the connection came in on IPv6, you'll see an IPv6 address.

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.   Paste as plain text instead

  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...