I am trying to get current users ip address using {$_SERVER['REMOTE_ADDR']} or {getenv('REMOTE_ADDR')}, in both of the cases i am getting ::1 . I am using php 7.1.1, can any one help how i can get current ip address of current user.
            Asked
            
        
        
            Active
            
        
            Viewed 2,085 times
        
    0
            
            
        - 
                    1Possible duplicate of [Get the client IP address using PHP](http://stackoverflow.com/questions/15699101/get-the-client-ip-address-using-php) – dsadnick Mar 31 '17 at 21:56
- 
                    2Possible duplicate of [How to get the client IP address in PHP?](http://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php) – n4m31ess_c0d3r Mar 31 '17 at 23:34
2 Answers
1
            
            
        If your using your local server it will always be ::1 or the local ip address.
$_SERVER['REMOTE_ADDR']
will return the ip when its on a server outside of your localnetwork.
 
    
    
        dsadnick
        
- 624
- 1
- 7
- 25
 
     
    