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.
0 comments:
Post a Comment