I use this code to understand some information of visitors (clients). It has been running on my virtual server on Xampp, but I can`t run on my main server (host). I see just a blank page.
$info = system('ipconfig /all');
echo $info;
this might help you
Server IP
You can get the server IP address from $_SERVER['SERVER_ADDR']
.
Client IP address
You can get the client IP from $_SERVER['REMOTE_ADDR']
Edit: you ask in comments how to get the output of an external command - one way is to use backticks, e.g.
$ipAddress=$_SERVER['REMOTE_ADDR'];
$macAddr=false;
#run the external command, break output into lines
$arp=`arp -a $ipAddress`;
$lines=explode("\n", $arp);
#look for the output line describing our IP address
foreach($lines as $line)
{
$cols=preg_split('/\s+/', trim($line));
if ($cols[0]==$ipAddress)
{
$macAddr=$cols[1];
}
}
But what if the client isn't on a LAN?
Well, you're out of luck unless you can have the client volunteer that information and transmit via other means. See Peter G Mac's suggestion for using Javascript.
you can also try following command
<?php
// http://www.php.net/manual/en/function.exec.php#85930
$_ = null;
// If you care about the return value, use this:
passthru("C:\\WINDOWS\\system32\\cmd.exe /c custom.bat",$_);
header('Content-Type: text/plain');
echo $_;
// if you don't care, just use this:
$_ = exec("C:\\WINDOWS\\system32\\cmd.exe /c custom.bat");
?>