Home > Software engineering >  PHP Get User Hardware Quality [NO JAVASCRIPT]
PHP Get User Hardware Quality [NO JAVASCRIPT]

Time:08-24

TLDR; Is it possible to get an approximation of whether user hardware is arbitrarily "good" or "bad" in order to serve them more or less resource intensive content using PHP NOT serving javascript first and relaying info?

I can't find anything online about it, but is there any way to get some basic information about the user's hardware using only the information PHP has access to? i.e. request headers likes user-agent string etc?

I don't mean detailed information like RAM, HDD Capacity, CPU, GPU etc, just an approximation to plug into a boolean value $good_hardware = true for example

Why? Javascript and CSS effects and animations can massively improve user engagement if not overused and properly placed, but some effects and scripts in particular can be extremely resource intensive.

It would nice to be able to have an idea of the user's hardware so that users with high performance machines can benefit from the increased engagement, but users with low-end machines can be served slightly different content with effects/scripts simplified or turned off altogether in order to improve the page speed

I am NOT looking for javascript solutions, as this should work from the landing page and not delay the user's first engagement with the site

CodePudding user response:

There is a Browser Capabilities Project for PHP that will give you all kinds of info about the Browser and a little bit about the machine. See PHP's get_browser().

These guys that say you can spoof the UA are not the sharpest knives in the drawer. 99.99% of the population does not know what a UA is. And, so what if someone does?

The bigger question is Why? Why do you want to rank visitors? That would give us some insight and possible have a solution. Basically you have our hands tied.

Obviously javascript is the correct tool for this job. Why no javascript? And I'm not talking extensive analyzation, based on javascript's ability to tell you about the visitor's screen size, and etc.

It's very simple. At the top of the HTML you have a simple javascript that simply stores the time. At onl oad, you write the time again. The difference between the two times gives you an excellent indicator of the user's machine performance.

But for whatever reason you want to avoid Javascript, you can get some very limited info from the user agent. You can get the OS, whether the machine is 16, 32, or 64 bit, and mobile or desktop. I cannot help you because I have no idea why you are doing this.

  • Related