I'm trying to get IP address (v4 or v6) of visitors. I've tried the request headers as
$_SERVER['HTTP_X_FORWARDED_FOR'] $_SERVER['REMOTE_ADDR'] but I've serious doubt on them.
However there are some sites which provides IP address for free, such as
However if I try file_get_contents I get the server's IP address and when I'm trying to retrieve the same through JavaScript I'm getting error Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource.
Please guide how to solve the issue, the aim is to get the visitor's IP in atleast 90% of cases if not for all.
source https://stackoverflow.com/questions/73846813/getting-ip-address-of-visitor
No comments:
Post a Comment