Wednesday 20 April 2022

How to get IP Address of System?

Run following PHP code for get IP Address.




<html>
<head>
 <title>What is my IP address?</title>
</head>
<body>
<?php
  $ipaddress = '';
    if ($_SERVER['HTTP_CLIENT_IP']){
        echo "1-Ip is:".$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    }
    else if($_SERVER['HTTP_X_FORWARDED_FOR']){
        echo "2-Ip is:".$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
    else if($_SERVER['HTTP_X_FORWARDED']){
        echo "3-Ip is:".$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
}     else if($_SERVER['HTTP_FORWARDED_FOR']){
        echo "4-Ip is:".$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
}     else if($_SERVER['HTTP_FORWARDED']){
        echo "5-Ip is:".$ipaddress = $_SERVER['HTTP_FORWARDED'];
}     else if($_SERVER['REMOTE_ADDR']){
        echo "6-Ip is:".$ipaddress = $_SERVER['REMOTE_ADDR'];
}     else{
        echo "7-Ip is:".$ipaddress = 'UNKNOWN';
}
?>
</body>
</html>






For more Interesting, Useful Article & codes visit IT New Code.

Ankit Shah PHP Expert

IT New Code suggest a solution for your problem related to coding, Specially .PHP, Wordpress, WooCommerce, Magento, HTML and CSS. Visit Our website for Information.

0 comments:

Post a Comment

 

Copyright @ 2016 IT New Code | Developing Code | Designing Code.

Designed by: Ankit Shah