I misread the OP. No. you can't get information on the hardware of a CLIENT's machine via PHP. You may be able to do it through some JS or I'm pretty sure through some ActiveX control (on Microsoft brosers of course). We make an appliance that "phones home" for updates and such, and therefore we have the luxury of a PHP crontab script that sends this information back to us. To us, they are "clients" -- different definition of client than the OP though. ;-) > -----Original Message----- > From: Daevid Vincent [mailto:daevid@xxxxxxxxxx] > Sent: Tuesday, August 23, 2005 1:25 PM > To: php-general@xxxxxxxxxxxxx > Cc: 'Saenal M' > Subject: RE: Hardware Detection > > This works on Linux/Unix boxen. > > //generate the global array here so we can re-use it > independant of output format > $device['os_ver'] = exec("/bin/uname -a"); > > $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth0 | /bin/grep > HWaddr"), -1, PREG_SPLIT_NO_EMPTY); > $device['MAC_addr_eth0'] = $temp[4]; > > $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth0 | /bin/grep > \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); > $device['dot_quad_ip_eth0'] = $temp[2]; > > $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 2>&1 > | /bin/grep > HWaddr"), -1, PREG_SPLIT_NO_EMPTY); > $device['MAC_addr_eth1'] = $temp[4]; > > $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 > 2>&1 | /bin/grep > \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); > $device['dot_quad_ip_eth1'] = $temp[2]; > > # look at /var for now as that seems to be where the bulk of > our data is > stored. > $temp = preg_split("/\s+/",exec("/bin/df | /bin/grep hda1"), -1, > PREG_SPLIT_NO_EMPTY); > $device['hd_size'] = $temp[1]; > $device['hd_used'] = $temp[2]; > > $temp = preg_split("/\s+/",exec("/usr/bin/free | /bin/grep Mem"), -1, > PREG_SPLIT_NO_EMPTY); > $device['ram_total'] = $temp[1]; > $device['ram_used'] = $temp[2]; > > $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | > /bin/grep 'model > name'"), -1, PREG_SPLIT_NO_EMPTY); > $temp1 = preg_split("/\s\s/",ltrim($temp[1]), -1, > PREG_SPLIT_NO_EMPTY); > $device['cpu_type'] = $temp1[0]; > $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'cpu > MHz'"), -1, PREG_SPLIT_NO_EMPTY); > $device['cpu_mhz'] = ltrim($temp[1]); > > $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep > 'VGA'"), 8), -1, > PREG_SPLIT_NO_EMPTY); > $device['video'] = $temp[1]; > > $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep > 'Host'"), 8), > -1, PREG_SPLIT_NO_EMPTY); > $device['mobo'] = $temp[1]; > > $ethernet = `/usr/bin/lspci | grep 'Ethernet'`; > $temp = split("\n",$ethernet); > $temp1 = preg_split("/:/",substr($temp[0],8), -1, > PREG_SPLIT_NO_EMPTY); > $device['nic_eth0'] = substr($temp1[1],1); > $temp1 = preg_split("/:/",substr($temp[1],8), -1, > PREG_SPLIT_NO_EMPTY); > $device['nic_eth1'] = substr($temp1[1],1); > > $device['proc_count'] = trim(`ps auxw | wc -l`); > > $device['someprocessd'] = trim(`ps axuw | grep "someprocessd" > | grep -v > "grep" | wc -l`); > > # Returns the uptime of a Linux system by parsing through > /proc/uptime. > # It returns a 4-field array (days, hours, minutes, seconds). > # I typically use it like: > # $ut = linuxUptime(); > # echo "Time since last reboot: $ut[0] days, $ut[1] hours, > $ut[2] minutes"; > $ut = strtok( exec( "cat /proc/uptime" ), "." ); > $days = sprintf( "%d", ($ut/(3600*24)) ); > $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) ); > $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 ); > $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60 ); > $device['uptime'] = $days."d ".$hours."h ".$min."m ".$sec."s"; > > //this version fails if the uptime is < 24 hours or 1 day > since it's shown > as 20:15 > //$temp = preg_split("/:/",exec("uptime"), -1, PREG_SPLIT_NO_EMPTY); > //$device['loadavg'] = substr($temp[2],1); > preg_match("/load average: (.*)/",exec("uptime"), $temp); > $device['loadavg'] = $temp[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php