PHP get visitor IP address and user agent

Tomorrow I’m going to make a small presentation and I need it the PHP code for getting the visitor IP address and the user agent (basically the browser). I know it’s not very difficult, but this is the kind of stuff you need thousands of times at hand and you look over and over on the web. So I’ll paste it here. Maybe tomorrow or the day after tomorrow I’ll need it again:

$_SERVER['REMOTE_ADDR'];
$_SERVER['HTTP_USER_AGENT'];

Advertisement



    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Connecting to %s



Follow

Get every new post delivered to your Inbox.