There's no sure-fire way to do this from any language ... PHP has access to the $_SERVER['HTTP_USER_AGENT'] variable, which you might try to analyze. Perhaps Javascript would be better, though, as it is client-side? navigator.appname or somesuch? Not that navigator.appname tells the type of device, though....