Ahhh - Thorpe, you evil genius, luckily in true cooking show style here's one I made earlier, and in context
<pre>
<?php
echo 'Physical address: "'.NIC_get_MAC().'"<br>';
echo 'IP (true): "'.NIC_get_IP().'"<br>';
echo 'Gateway: "'.NIC_get_gateway().'"<br>';
echo 'All NICS: ';
print_r(NIC_get_MACS());
$ipc = `"ipconfig /all"`;
echo $ipc;
// if more than one on the machine get the description and ip
// will work as long as ipconfig still returns the physical address under the description
function NIC_get_MACS()
{
$ipc = `"ipconfig /all"`;
$pat = '/Description.*: ([^\r]*)\W*physical address.*: (\S*)\r\n/i';
preg_match_all($pat, $ipc, $matches, PREG_SET_ORDER);
foreach($matches as $key => $sub)
{
unset ($matches[$key][0]);
$matches[$key]['desc'] = $matches[$key][1];
$matches[$key]['addr'] = $matches[$key][2];
}
return $matches;
}
// returns the MAC address of your NIC by reading ipconfig
function NIC_get_MAC()
{
$ipc = `"ipconfig /all"`;
$pat = '/physical address.*: ([\S]*)/i';
if (!preg_match($pat, $ipc, $matches)) return false;
return $matches[1];
}
function NIC_get_IP()
{
$ipc = `"ipconfig"`;
$pat = '/IP Address.*: ([\S]*)/i';
if (!preg_match($pat, $ipc, $matches)) return false;
return $matches[1];
}
function NIC_get_gateway()
{
$ipc = `"ipconfig"`;
$pat = '/Default Gateway.*: ([\S]*)/i';
if (!preg_match($pat, $ipc, $matches)) return false;
return $matches[1];
}
?>
</pre>