Browser Sniffer

Here’s a short PHP script that gathers info about the browser and the IP address of the client and returns it via email. I used it to gather data on cell phone browsers, and got the results seen at the bottom over the course of a day. Thanks to all those folks who hit it.

Technorati Tags: , ,


<?php
/*
	Phone Finder
	Language: PHP  

	Identifies the user agent and IP address.  Runs on mobile phones.

*/
  $userAgent =  $_ENV["HTTP_USER_AGENT"];
  $ipAddress =  $_ENV["REMOTE_ADDR"];
  sendEmail('you@yourserver.com', 'user agent', "$userAgent $ipAddress");

  	echo <<<END
<html>
<head></head> 

<body>
	<h2>Hi There</h2>
		Your IP: $ipAddress<br>
		Your browser: $userAgent<br>
		Thanks!
</body>
</html>
END;
  end;

function sendEmail($to, $subject, $message) {
	$from = "phone@yourserver.com";
	mail($to, $subject, $message, "From: $from");
}
  ?>

Here’s a sampling of some of the phones that hit it. IP addresses deleted to protect the innocent:

Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/
NokiaN73-1/2.0628.0.0.1 S60/3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
NokiaN93-1/20.0.058 SymbianOS/9.1 Series60/3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
Nokia6230/2.0 (05.51) Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0
BlackBerry8100/4.2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
BlackBerry7230/3.7.0
BlackBerry7290/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100 216.9.250.99
LGE-PM325/1.0 UP.Browser/6.2.3.2 (GUI) MMP/2.0
Palm680/RC1 Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/Palm-D053; Blazer/4.5) 16;320x320 UP.Link/6.3.0.0.
Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320) BlackBerry8100/4.2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/Palm-D052; Blazer/4.5) 16;320x320 68.28.123.118
SAMSUNG-SGH-A707/1.0 SHP/VPP/R5 NetFront/3.3 SMM-MMS/1.2.0 profile/MIDP-2.0 configuration/CLDC-1.1 UP.Link/6.3.0.0.0
Mozilla/4.0 (MobilePhone RL-4920/US/1.0) NetFront/3.1 MMP/2.0
Mozilla/4.0 Sprint:MotoQ (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)
SonyEricssonW810i/R4CE Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.1.17.0
Nokia6682/2.0 (4.62.0) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0
MOT-RAZRV3xx/96.71.95R BER2.2 Mozilla/4.0 (compatible; MSIE 6.0; 11063081) Profile/MIDP-2.0 Configuration/CLDC-1.1  Opera 8.00 [en] UP.Link/6.3.0.0.0
This entry was posted in PHP. Bookmark the permalink.

Comments are closed.