for those web 1.0 diehards – remember HTTP_USER_AGENT
Well the venerable user agent is the key environment variable used to identify the handsets users are using.
The upside is it is easy to read.
The downside is – the usage (and information) is entirely non-standard across multiple mobile operating systems and even model versions within the same O/S.
But the good news is – it has effectively been crowdsourced.
Check out this eponymously named site.