I have created below script which works just fine and get me the uptime of the current server -
$server = $_POST['server'];
// only digits
$pattern = '/[^0-9]/';
$uptime = `c:\windows\system32\uptime2.bat $server`;
$uptime = explode(": ", $uptime);
$uptime = explode(", ", $uptime);
$uptime_days = preg_replace($pattern, '', $uptime);
$uptime_hours = preg_replace($pattern, '', $uptime);
$uptime_minutes = preg_replace($pattern, '', $uptime);
$uptime_seconds = preg_replace($pattern, '', $uptime);
echo 'Days: '.$uptime_days.'<br>';
echo 'Hours: '.$uptime_hours.'<br>';
echo 'Minutes: '.$uptime_minutes.'<br>';
echo 'Seconds: '.$uptime_seconds.'<br>';
In which uptime2.bat consist of following information -
I would like to know, how can I modify this code to pass multiple servers as input and get all the below servers details like -
I hope I am able to convey my question here. Any pointers on this would be appreciated.
Thank you in advance.
Check out PHPSysInfo. It does pretty much what you are wanting to do for single servers. Maybe you can take a look at the code and modify it to suit your use case.