forked from BlakeGardner/php-mac-address
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
34 lines (26 loc) · 892 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
echo "\n";
// require the class
require_once './src/BlakeGardner/MacAddress.php';
// import the class
use BlakeGardner\MacAddress;
// get the mac address of the eth0 interface
echo "Current MAC address: ";
var_dump(MacAddress::getCurrentMacAddress('eth0'));
echo "\n";
// generate a random mac address
echo "Randomly generated MAC address: ";
var_dump(MacAddress::generateMacAddress());
echo "\n";
// validate an MAC address
echo "Validating MAC address: ";
var_dump(MacAddress::validateMacAddress('00-B0-D0-86-BB-F7'));
echo "\n";
// set a randomly generated MAC address on the eth0 interface
echo "Setting a randomly generated MAC address: ";
var_dump(MacAddress::setFakeMacAddress('eth0'));
echo "\n";
// set a specific MAC address on the eth0 interface
echo "Setting a specific MAC address: ";
var_dump(MacAddress::setFakeMacAddress('eth0', '00:E4:01:2C:79:DA'));
echo "\n";