PHP Classes

Mac Address: Retrieve the Mac address of a network card

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 39%Total: 1,924 All time: 2,050 This week: 78Up
Version License PHP version Categories
mac-address 1.0Artistic License5.0Networking, PHP 5, Unix, Windows
Description 

Author

This class can be used to retrieve the Mac address of a network card.

It takes the name of a network card interface and executes a system command to retrieve the Mac address of that network card.

The class supports determining the Mac address on FreeBSD, Linux and Windows.

Picture of giulio
Name: giulio <contact>
Classes: 4 packages by
Country: Italy Italy
Age: 39
All time rank: 98036 in Italy Italy
Week rank: 215 Up14 in Italy Italy Up

Recommendations

mac address
Need to get mac address from login machine

Example

<?php

require_once (MacAddress.php");

$mac = new MacAddress ('00:FF:AB:CC:DD:FF');

echo
$mac->output ('.',4)."\n"; // 00FF.ABCC.DDFF

echo
$mac->output ('.',4,'lower')."\n"; // 00ff.abcc.ddff
echo
$mac->output ('-',2,'upper')."\n"; // 00-FF-AB-CC-DD-FF
echo
$mac->output (':',2,'lower')."\n"; // 00:ff:ab:cc:dd:ff

$mac2 = new MacAddress ($mac->GetMacAddr()); // mac of eth0 of my server
echo
$mac2->output (':',2,'lower')."\n"; // 00:50:56:ac:52:7b
echo
$mac2->output ('.',4,'lower')."\n"; // 0050.56ac.527b
echo
$mac2->output ('.',4,'upper')."\n"; // 0050.56AC.527B


?>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file example.php Example example file
Plain text file MacAddress.php Class Mac address main class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,924
This week:0
All time:2,050
This week:78Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:39%StarStar
Rank:3869