Cara Mendapatkan Mac Address Menggunakan PHP

Untuk mendapatkan informasi mac address kita menggunakan PHP :

<?php
// Turn on output buffering
ob_start();

//Get the ipconfig details using system commond
system(‘ipconfig /all’);

// Capture the output into a variable
$mycom=ob_get_contents();

// Clean (erase) the output buffer
ob_clean();

$findme = “Wireless LAN adapter WiFi”;
//Search the “Physical” | Find the position of Physical text
$pmac = strpos($mycom, $findme);

// Get Physical Address
$mac = substr($mycom,($pmac+202),17);

//Display Mac Address
echo $mac;

?>

Code di atas menggunakan cara menampilkan hasil dari ipconfig /all bila kita ketikkan di cmd, nah hasilnya kita ambil pakai buffering. nah setelah dapat kita ambil deh pakai metode strpos dan substr.

sumber : http://www.webinfopedia.com/php-get-system-mac-address.html

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s