cbschuld/Browser.php

Identify PlayStation systems

Closed this issue · 3 comments

The PlayStation 3, 4 and Vita web browser share a pretty simple structure:

Mozilla/5.0 (Playstation $version[;] $firmware) AppleWebkit(......)

$version: 3, 4, Vita
$firmware: X.XX (i.e. 3.55)

The PlayStation 3 has a semi-colon, appearently, whilst Vita and 4 do not.

To classify:

    const BROWSER_PLAYSTATION = "PlayStation";
    const PLATFORM_PLAYSTATION = "Sony PlayStation";

PS 3 and 4 are "Desktop" and not mobile. Vita is mobile.

Unfortunately I am not perfectly sure of the results for the PSP.

Could they be implemented?

I realize this is issue is a year old but I'm learning GitHub by trying to help that is why I sent a pull request.

@IngwiePhoenix Try this code with my forked version 😃

<?php
require 'lib/Browser.php';

$agent = $_SERVER['HTTP_USER_AGENT'];
$browser = new Browser($agent);
if ($browser->getBrowser() == Browser::BROWSER_PLAYSTATION) {
    echo "Browser = " . $browser->getBrowser();
    echo '<br>';
    echo "Version = " . $browser->getVersion();
    echo '<br>';
    echo "isMobile = " . ($browser->isMobile() ? 'true' : 'false');
    echo '<br>';
    echo "Platform = " . $browser->getPlatform();
}

?>

Closed in a57a9b9

@IngwiePhoenix @FootballFan141 - was merged & all set; closing.