Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get IP address of remote machine in PHP?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 227
    Comment on it

    Hello Reader's if you want to make the tracking system of your website, then the best way is to get the records of the IP address from user. Getting the IP of remote of PC can done on various ways. PHP let you do this by using  $_SERVER['REMOTE_ADDR'];

    Using code above you will get the IP,

    But sometimes this will return the exact IP of remote PC because of various proxy server might in use.

    But still you can have the records of individual users accessing your website. But in the cases where the IP is conflicting then you can use the code as below:-

    $ip = _SERVER['REMOTE_ADDR']?:$_SERVER['HTTP_X_FORWARDED_;FOR']?:$_ERVER['HTTP_CLIENT_IP']);

    The code above is used to get correct this is issue you can use just the code below, that will return IP in $get_ip variable.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: