#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    21
    Rep Power
    0
    In PERL, you do something like
    $Agent = $ENV{'HTTP_USER_AGENT'};

    But to do these in PHP?
    i) Get user's browser
    ii) Get user's IP
    iii) Get user's referrer

    Thanks in advance.
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    i) Get user's browser
    >>


    echo $HTTP_USER_AGENT;


    <<
    ii) Get user's IP
    >>


    echo $REMOTE_ADDR;


    <<
    iii) Get user's referrer
    >>


    echo $HTTP_REFERER;


    See manual for more details




    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    Yes, ENV variables are just them selves in PHP, but something you may want to get the variable manually for compatibility:

    $backto = getenv("HTTP_REFERER");

    I've heard that just $BLAH sometimes doesn't work (though I've had no problem with it)
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    21
    Rep Power
    0
    Yup, $HTTP_USER_AGENT is blank!!!


    But $HTTP_USER_AGENT=getenv(HTTP_USER_AGENT);
    will do the trick!

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 11:45 PM
  2. Using PHP to display dynamic variables from loops
    By tryin2learnphp in forum PHP Development
    Replies: 1
    Last Post: February 17th, 2004, 01:51 AM
  3. PHP Sessions, dynamic variables
    By eddygo in forum PHP Development
    Replies: 1
    Last Post: February 12th, 2004, 05:01 PM
  4. php code to use variables from the url
    By Nullified in forum PHP Development
    Replies: 2
    Last Post: January 30th, 2004, 03:19 PM
  5. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 02:14 PM

IMN logo majestic logo threadwatch logo seochat tools logo