PHP Script to detect the Ip of the request

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • taco.de.tripa
    replied
    Thanks a lot my friend.>

    Leave a comment:


  • something else
    replied
    you may wish to add*
    Code:
     else if($_user_ip=="unknown")$_user_ip = $_SERVER['REMOTE_ADDR'];
    for blackberrys*


    __________________

    mmmmmm tasty!
    Last edited by something else; 05.06.09, 01:45. Reason: because i can lol

    Leave a comment:


  • taco.de.tripa
    replied
    Originally posted by Anshul View Post
    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); 
    
    Thanks, it did the trick.

    Leave a comment:


  • Anshul
    replied
    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,
Working...
X