Detecting and Identifying the PlayStation Portable (PSP) Browser
Continuing my evaluation of the PSP’s web browser I thought I would discuss about how to detect and identify a visitor to your website using the Playstation Portable browser.
When we are working to identify the browser we typically reference the HTTP Protocol, which in part of its request stage the browser attaches information about the browser in the HTTP header parameters. If you are using Firefox a good plugin to get that helps you analyse the HTTP request is called LiveHeaders. In PHP we can access environmental settings and sections of the HTTP request through the $_SERVER vars.
Using PHP we will first create a simple script that prints out the $_SERVER vars in order to analyse different sections:
<?php print_r($_SERVER); ?>
Analysing the request
Save the contents to a file called “detect.php� and upload to a server that can serve PHP. Next use your browser to request the file. For instance: http://localhost/pathto/detect.php
A standard output may look similar to below:
Array
(
[HTTP_HOST] => localhost
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
[HTTP_ACCEPT] => application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 300
[HTTP_CONNECTION] => keep-alive
[PATH] => C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\ATI Technologies\\ATI Control Panel;C:\\Program Files\\QuickTime\\QTSystem\\;C:\\server\\mtasc-1.12\\
[SystemRoot] => C:\\WINDOWS
[COMSPEC] => C:\\WINDOWS\\system32\\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[WINDIR] => C:\\WINDOWS
[SERVER_SIGNATURE] =>
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/4.4.1-pl1 Server at localhost Port 80[SERVER_SOFTWARE] => Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/4.4.1-pl1
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => C:/server/xampp/htdocs
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => C:/server/xampp/htdocs/detect.php
[REMOTE_PORT] => 2049
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /detect.php
[SCRIPT_NAME] => /detect.php
[PHP_SELF] => /detect.php
[PATH_TRANSLATED] => C:/server/xampp/htdocs/detect.php
[argv] => Array
(
)[argc] => 0
)
The $_SERVER variable provides us a lot of information about the server, but also important information about the environment or HTTP Request. You can see by looking at the “HTTP_USER_AGENT� value in the array what browser environment the user is running under.
Each browser software has a unique agent identifier (or HTTP_USER_AGENT) that allows to learn about the browser. For Internet Explorer the HTTP_USER_AGENT may be like below:
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; OptusNetDSL6; .NET CLR 1.1.4322)
It provides us information about the OS environment, the Browser, Versions and Suppliers.
The PlayStation Portable PSP Request
I do not have a localhost instance of an apache server running on the PSP so I will point the PSP to the original server to see the request:
Array
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/4.4.1-pl1 Server at 10.1.1.100 Port 80
(
[HTTP_ACCEPT] => */*;q=0.01
[HTTP_USER_AGENT] => Mozilla/4.0 (PSP (PlayStation Portable); 2.00)
[HTTP_X_PSP_PRODUCTCODE] => AU3
[HTTP_X_PSP_BROWSER] => 2.80 (LX; system=2.80)
[HTTP_HOST] => 10.1.1.100
[HTTP_ACCEPT_LANGUAGE] => en
[HTTP_CONNECTION] => Keep-Alive
[PATH] => C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\ATI Technologies\\ATI Control Panel;C:\\Program Files\\QuickTime\\QTSystem\\;C:\\server\\mtasc-1.12\\
[SystemRoot] => C:\\WINDOWS
[COMSPEC] => C:\\WINDOWS\\system32\\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[WINDIR] => C:\\WINDOWS
[SERVER_SIGNATURE] =>[SERVER_SOFTWARE] => Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/4.4.1-pl1
[SERVER_NAME] => 10.1.1.100
[SERVER_ADDR] => 10.1.1.100
[SERVER_PORT] => 80
[REMOTE_ADDR] => 10.1.1.103
[DOCUMENT_ROOT] => C:/server/xampp/htdocs
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => C:/server/xampp/htdocs/detect.php
[REMOTE_PORT] => 56117
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /detect.php
[SCRIPT_NAME] => /detect.php
[PHP_SELF] => /detect.php
[PATH_TRANSLATED] => C:/server/xampp/htdocs/detect.php
[argv] => Array
(
)[argc] => 0
)
The PSP browser agent in this case can be identified through the $_SERVER parameters
[HTTP_USER_AGENT] => Mozilla/4.0 (PSP (PlayStation Portable); 2.00)
[HTTP_X_PSP_PRODUCTCODE] => AU3
[HTTP_X_PSP_BROWSER] => 2.80 (LX; system=2.80)
Which shows us the PSP product code and the Firmware that the client is running.
What now?
From here we could design into our HTML header a way to load different CSS presentation for the PSP with some simple regular expression syntax:
<?php if(preg_match('/.*PSP.+PlayStation.*/', $_SERVER['HTTP_USER_AGENT'])) {
// Do something like loading a different style sheet or possibly redirecting the user
print '<h1>Hello PSP World</h1>';
} ?>






Fantastic, this is just what I was looking for….Roll on PSP websites!
Quick question…
Did you use localhost on an apache server and connect your PSP via your USB to your PC for testing that header?
Comment by David — December 14, 2007 @ 10:22 pm
Hi David,
I believe I tested by using a WIFI connection and pulling up a network address. The server environment was Apache.
Hope this helps,
Cheers
cameron
Comment by Cameron Manderson — December 15, 2007 @ 9:02 am