PHP Script to detect the Ip of the request
Collapse
X
-
you may wish to add*
for blackberrys*Code:else if($_user_ip=="unknown")$_user_ip = $_SERVER['REMOTE_ADDR'];
__________________
mmmmmm tasty!
Leave a comment:
-
Thanks, it did the trick.Originally posted by Anshul View PostPHP Code:if (isSet($_SERVER['HTTP_X_FORWARDED_FOR'])) $_user_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isSet($_SERVER['HTTP_CLIENT_IP'])) $_user_ip = $_SERVER['HTTP_CLIENT_IP']; else if($_SERVER['REMOTE_ADDR']) $_user_ip = $_SERVER['REMOTE_ADDR']; else {$_user_ip = 'not detected';} $_user_ip = preg_replace("/[^0-9.]/", "", $_user_ip);
Leave a comment:
-
PHP Code:if (isSet($_SERVER['HTTP_X_FORWARDED_FOR'])) $_user_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isSet($_SERVER['HTTP_CLIENT_IP'])) $_user_ip = $_SERVER['HTTP_CLIENT_IP']; else if($_SERVER['REMOTE_ADDR']) $_user_ip = $_SERVER['REMOTE_ADDR']; else {$_user_ip = 'not detected';} $_user_ip = preg_replace("/[^0-9.]/", "", $_user_ip);
Leave a comment:
-
PHP Script to detect the Ip of the request
Hi guys,
I'm developing a wap site and I'd like to detect the IP of the phone to display the content according to the IP so, do you know how I will be able to detect this value using PHP?
Thanks in advance,Tags: None
Leave a comment: