  | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ค่า MAC ไม่ได้ถูกส่งไปกับ header ด้วยนะครับ เพราะฉะนั้นดูไม่ได้ครับ หรือ ใครมีวิธีอื่นก้อแนะนำด้วยนะครับ อยากรู้เหมือนกัน                            
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-05-04 11:32:50 | 
                        By :
                            noomna19 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 อยากรู้ด้วยคนอ่ะ 
 
อิอิ 
 
 
ผู้รู้ช่วยด้วยนะค่ะ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-05-05 17:33:59 | 
                        By :
                            kanowan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
/**
 * Class NtMacAddress
 *		Returns client or server Mac Address in an intranet NT5 or NT5.1 LAN
 * -----------------------------------------------
 * EXAMPLE:
 *		$mac = &new NtMacAddress();
 *		echo 'SERVER MAC: '.$mac->getMac( 'server' ).'<br />CLIENT MAC: '.$mac->getMac( 'client' );
 * 
 * NOTE: This class works only in a LAN then you will not read anything if try on localhost.
 *	 So please use from another PC.
 * _______________________________________________
 *
 * @author		Andrea Giammarchi
 * @compatibility	Windows 2000 / Server , Windows XP
 *			( but maybe found *nix and other OS client macaddress too )
 * @site		www.3site.it
 * @date		09/10/2004
 * @version	1.0	tested only on Win 2K / XP
 */
class NtMacAddress {
	/**
	 * Public method getMach. Returns client or server mac-address if is readable.
	 *
	 *		NtMacAddress->getMac( $what:String ):String
	 *
	 * @param	String		Options: 'client' or 'server'
	 * @return	String		Mac-Address if is readable, 'not found' otherwise
	 */
	function getMac( $what ) {
		$what = &strtolower( $what );
		if( $what == 'server' ) {
			return $this->__server_macaddress();
		}
		elseif( $what == 'client' ) {
			return $this->__client_macaddress();
		}
		else {
			return '\'client\' or \'server\' ?';
		}
	}
	/**
	 * Private method __server_macaddress. Returns server mac-address if is readable.
	 *
	 *		NtMacAddress->__server_macaddress():String
	 *
	 * @param	no
	 * @return	String		Server Mac-Address if is readable, 'not found' otherwise
	 */
	function __server_macaddress() {
		$output = Array();
		exec( 'netstat -r', $output );
		for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) {
			if( preg_match( "/(?i)([a-z0-9]{2} ){6}/", $output[$a] ) == true ) {
				$macaddress = &$output[$a];
				$uniquekey = &md5( $macaddress );
				$output[$a] = &preg_replace( "/(?i)([^a-z0-9]*?)([a-z0-9]{2} ){6}/i", "\\1 {$uniquekey} ", $output[$a] );
				$output[$a] = &explode( " {$uniquekey} ", $output[$a] );
				$uniquekey = Array( trim( $output[$a][0] ), trim( $output[$a][1] ) );
				$macaddress = &str_replace( $uniquekey, "", $macaddress );
				return trim( $macaddress );
			}
		}
		return 'not found';
	}
	/**
	 * Private method __client_macaddress. Returns client mac-address if is readable.
	 *
	 *		NtMacAddress->__client_macaddress():String
	 *
	 * @param	no
	 * @return	String		Client Mac-Address if is readable, 'not found' otherwise
	 */
	function __client_macaddress() {
		$output = Array();
		exec( 'nbtstat -A '.$_SERVER['REMOTE_ADDR'], $output );
		$reg = '([a-f0-9]{2}\-){5}([a-f0-9]{2})';
		for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) {
			if( preg_match( "/(?i){$reg}/", $output[$a] ) == true ) {
			        return preg_replace( "/(?iU)(.+)({$reg})(.*)/", "\\2", $output[$a] );
			}
		}
		return 'not found';
	}
}
 
 
============= 
 
ผมลองแล้วได้ผลแบบนี้  
SERVER MAC: Array 
CLIENT MAC: not found 
ไม่รู้จะให้ผลออกมาเป็นเลข MAC ยังไง ใครรูบ้างมาต่อให้หน่อย                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-05-05 22:42:06 | 
                        By :
                            NOHARA | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ที่ผมใช้อยู่ก็ OK นะลองกันดูนะครับ เป็นตัวที่ดูเครื่อง Client โดยโค๊ตนี้ไว้ที่ Server อ่ะนะ ใช้เรียกโค๊ตตัวนี้มาดูอ่ะนี่เป็นการโพสครั้งแรกอ่ะ โชคดีครับ 
============== 
<? 
function __client_macaddress() { 
      $output = Array(); 
      exec( 'nbtstat -A '.$_SERVER['REMOTE_ADDR'], $output ); 
      $reg = '([a-f0-9]{2}\-){5}([a-f0-9]{2})'; 
      for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) { 
         if( preg_match( "/(?i){$reg}/", $output[$a] ) == true ) { 
                 return preg_replace( "/(?iU)(.+)({$reg})(.*)/", "\\2", $output[$a] ); 
         } 
      } 
      return 'not found'; 
   } 
 
?> 
 
<?php 
echo("".__client_macaddress()); 
?>                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-08 11:40:49 | 
                        By :
                            mmtc008 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 คุณ Tis ผมลองแล้ว แต่มันขึ้น  not found                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-08 15:27:06 | 
                        By :
                            panyapol | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 คำสั่ง netstat -r และ nbtstat -a 
เป็นคำสั่งของ command line บน window เท่านั้นนะครับ 
ถ้าคุณใช้ web server บน OS ที่เป็น window ก็จะใช้งานได้ 
แต่ถ้า web server นั้นอยู่บน OS ที่เป็น linux จะใช้ไม่ได้นะครับ 
โดยเฉพาะ nbrstat จะไม่รู้จักเลย ส่วน netstat ข้อมูลที่ออกมาจะ  
format ไม่เหมือนที่แสดงบน OS window  เลยนะครับ 
เพราะฉะนั้นระวังด้วย ครับ 
 
ส่วนบน linux get mac address ยังไง รอผู้รู้มาตอบอีกทีครับ 
 
ขอถามเพิ่มครับ ถ้า เครื่อง client มี interface หลายตัว จะ get mac แต่ละตัวเลย ต้องทำยังไงอ่าคับ 
อันนี้อยากรู้ไว้ประดับความรู้เฉยๆ ครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-08 22:25:42 | 
                        By :
                            nut_t02 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 อ่อ ....ทราบเลยครับ                          
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-09 08:08:15 | 
                        By :
                            panyapol | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 มันไม่ยอมขึ้นครับผม เป็นแบบนี้เลยครับผม  not found                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-12-18 20:25:10 | 
                        By :
                            อนุชา พวงผกา | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 มีใครทำได้หรือยังครับ   ช่วยหน่อยครับ  
คำสั่งนี้ ทำให้เครื่องอืดมากครับ  
 
Code (PHP) 
<?
function __client_macaddress() {
$output = Array();
exec( 'nbtstat -A '.$_SERVER['REMOTE_ADDR'], $output );
$reg = '([a-f0-9]{2}\-){5}([a-f0-9]{2})';
for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) {
if( preg_match( "/(?i){$reg}/", $output[$a] ) == true ) {
return preg_replace( "/(?iU)(.+)({$reg})(.*)/", "\\2", $output[$a] );
}
}
return 'not found';
}
?>
<?php
echo("".__client_macaddress());
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2010-10-11 11:51:29 | 
                        By :
                            Nat | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เหมือนกัน อยากรู้ ...                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-05-24 18:20:04 | 
                        By :
                            ssc | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 <?php 
/* 
* Getting MAC Address using PHP 
* Md. Nazmul Basher 
*/ 
 
ob_start(); // Turn on output buffering 
system(‘ipconfig /all’); //Execute external program to display output 
$mycom=ob_get_contents(); // Capture the output into a variable 
ob_clean(); // Clean (erase) the output buffer 
 
$findme = “Physical”; 
$pmac = strpos($mycom, $findme); // Find the position of Physical text 
$mac=substr($mycom,($pmac+36),17); // Get Physical Address 
 
echo $mac; 
?> 
แต่เป็นฝั่ง Server ครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-12-21 11:56:39 | 
                        By :
                            fossil31 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ช่วย กันหน่อย ครับ พอดี กำลังอยากได้ตรงนี้พอดี ครับ    จากที่ คุณ rith  มันไม่ยอมขึ้นครับผม เป็นแบบนี้เลยครับผม not found ผมใช้คำสัง " arp -a "                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2012-04-03 17:21:13 | 
                        By :
                            yainakrub | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 มาคอนเฟิมโค๊ดคุณ mmtc008 ครับ ใช้ได้ครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2012-05-17 15:31:46 | 
                        By :
                            taomasaba | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมทดลองหลายโค้ด ขนโค้ดมาทดสอบทั้งโลกแล้ว 
ในทางปฏิบัติ 
บน win เช็ค Mac address ของเครื่องลูกข่ายไม่ได้ เช็คได้แต่ตัวเครืองมันเอง   โค้ดทีเจ๋งๆ พอโยนขึ้น server มันก็เช็คแต่การ์ดแลน ของ server  คงเพราะ php มันประมวลผลบน server 
 
บน Linux บน Host ที่ผมเช่าๆ ไว้ พบว่า ทาง Host ปิด service ของ exec (เพื่อความปลอดภัย) 
 
 
 
สรุปว่า  
ปัจจุบัน บน windows หรือ Linux ยังสั่งให้เช็ค เครื่องลูกข่าย ได้หรือเปล่าครับ  ทีในกระทู้บอกว่าได้ เช็คดีแล้วหรือเปล่า ว่า เป็น mac ของลูกข่ายๆ แน่ๆ 
 
ใครทราบช่วยหน่อยครับ อยากได้โค้ด 
ขอบคุณครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2012-11-23 12:38:43 | 
                        By :
                            พ่อหนูดี | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (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 = "Physical";
                //Search the "Physical" | Find the position of Physical text
                $pmac = strpos($mycom, $findme);
                // Get Physical Address
                $mac=substr($mycom,($pmac+36),17);
                //Display Mac Address
                echo "MAC4 : ".$mac;
 
 
Credit : http://www.webinfopedia.com/php-get-system-mac-address.html                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-03-20 22:47:04 | 
                        By :
                            meen2nont | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมลองแล้วครับ 
สคริปที่  No. 16 
ใช้งานได้จริงครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-20 09:46:50 | 
                        By :
                            สรายุทธ์ | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 โค้ดของ No. 16 มันแสดง Mac ของเครื่อง Server ครับ 
 
คำสั่ง ipconfig /all มันแสดงข้อมูลเครื่อง Server                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-08-19 15:52:21 | 
                        By :
                            warin | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     |