Jump to content


This topic is now archived and is closed to further replies.


Capturing IP Address and Browser info

Recommended Posts

I am using the following two methods now to capture above mentioned info:

$ip_address = $_SERVER['REMOTE_ADDR'];

$user_browser = $_SERVER['HTTP_USER_AGENT'];

This user info is captured and sent in an email to me and works perfectly on our Test Server. However, on the Live Server this does not get captured (I get an email with a blank).

What could be the cause of this???

Share this post

Link to post
Share on other sites

$ip_address = $_SERVER['REMOTE_ADDR'];

$user_browser = $_SERVER['HTTP_USER_AGENT'];

//add From: header
$headers = "From: \"Online Survey\" webserver@localhost\r\n";

//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";

//unique boundary
$boundary = uniqid("HTMLDEMO");

//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
  "; boundary = $boundary\r\n\r\n";

//message to people with clients who don't understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";

//HTML version of message
$headers .= "--$boundary\r\n" .
  "Content-Type: text/html; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("IP Address: $ip_address Browser: $user_browser"))

//send message
mail("yana@greatgulfhomes.com,yanochka_@hotmail.com", "Online Survey", "", $headers);


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.