To Get Client Hardware Information Using PHP, we have to follow 2 major step,
- Include system info class (SystemInfo)
- Call functions from SystemInfo class to get Client Hardware Information.
I also provide you complete script to download and run it on your hosting server or on local host.
Note:
Generally, PHP is executed on the server-side, and it has limited or partially access to the Hardware Information of the server but it has no way to access the Hardware Information of the user’s system.
But if you want to do that, is only way I can think of by using ActiveX plugins or a browser addon.
And for testing, you can run the complete script by using your local host (XAMPP or WAMP). Check here how any PHP script runs locally https://codingtasks.net/how-php-code-works/#4_Step_to_Run_PHP_Code_Locally.
Include System Info Class (SystemInfo)
You can get complete system info class from github repo and include it. SystemInfo Code
Call Functions From SystemInfo Class to Get Client Hardware Information
You can also execute it on Run PHP Code (codingtasks.net)
1 2 3 4 5 6 7 8 9 10 |
<?php // Example $system = new SystemInfo(); echo "CPU usage: " . $system->getCpuLoadPercentage() . "%<br/>"; echo "Disc: <br/>"; print_r($system->getDiskSize(PHP_OS == 'WINNT' ? 'C:' : '/')); echo "<br/><br/>"; echo "RAM total: " . round($system->getRamTotal() / 1024 / 1024) . " MB <br/>"; echo "RAM free: " . round($system->getRamFree() / 1024 / 1024) . " MB <br/>"; ?> |
Output:
CPU usage: 41%
Disc:
Array ( [size] => 289783410688 [free] => 237840752640 [used] => 51942658048 )RAM total: 6046 MB
RAM free: 2317 MB
Download Source Code
Also Check:
- Get Current City State and Zip Code Using PHP
- Count Number of Visits Using PHP Cookies
- Send Mail Attachments with PHP Mail()
- Increase PHPMyAdmin Import Size Ubuntu and XAMPP
Happy Coding..!
One Reply to “How to Get Client Hardware Information Using PHP”