[英]How to i Get Client System MAC Address from Bigrock Cpanel using PHP
我已经使用下面提到的php代码从客户端系统获取mac地址,它在我的本地系统(Windows OS)中运行良好。 当我在Bigrock Cpanel上使用此代码时,它显示空白页。 请澄清这个问题。
Example:
ob_start();
system('ipconfig /all');
$mycom=ob_get_contents();
ob_clean();
$findme = 'Physical';
$pmac = strpos($mycom, $findme);
$mac=substr($mycom,($pmac+36),17);
echo $mac;
尝试使用以下php代码:
<?php
ob_start();
system('/sbin/ifconfig -a');
$mycom=ob_get_contents();
ob_clean();
$findme = 'physique';
$pmac = strpos($mycom, $findme);
$mac=substr($mycom,($pmac+38),22);
echo "$mac\r";
?>
这在我的CentOS 6.9 linux服务器上可以正常工作:
64/5236# php get-mac.php
00:1A:10:1F:0A:1E
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.