Hi guys,
Can i get the machine code of my computer by a function of PHP, or in other methods in php?
Plz give me a hand~~~
Thanks in advance~~~
How to get the machine code of my computer in php?
Moderator: General Moderators
machine code? hmmm, if you mean IP address it's:
make a blank .php page and type in only phpinfo(); you should get more from there
Code: Select all
<?php
$REMOTE_ADDR
or
$REMOTE_HOST
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It may be that $REMOTE_ADDR nor $REMOTE_HOST appear to be unavailable to you - if so then try:
if you have PHP 4.1 or above, or
if you have PHP 4.0.6 or below.
Mac
Code: Select all
$_SERVERї'REMOTE_ADDR']
// or
$_SERVERї'REMOTE_HOST']Code: Select all
$HTTP_SERVER_VARSї'REMOTE_ADDR']
// or
$HTTP_SERVER_VARSї'REMOTE_HOST']Mac
afaik there is no php function to retrieve that kind of information.
But you may use external programs.
with winnt/2k/xp ships a program called ipconfig. ipconfig /all will show all mac addresses of all adapters.
linux/unix systems usually have ifconfig. ifconfig eth0 e.g. shows all infos of adapter eth0.
you can fetch the ouput via exec() and filter it.
e.g.catches the mac of eth0 at my linux box at bash command line
But you may use external programs.
with winnt/2k/xp ships a program called ipconfig. ipconfig /all will show all mac addresses of all adapters.
linux/unix systems usually have ifconfig. ifconfig eth0 e.g. shows all infos of adapter eth0.
you can fetch the ouput via exec() and filter it.
e.g.
Code: Select all
ifconfig eth0 | grep "HWaddr" | sed -e 's/.*HWaddr \(.*\)/\1/g'