0

I was trying the below code but it is not working working in the cloud server but is working in my localhost.

ob_start();
system('ipconfig /all');
$mycom=ob_get_contents();
ob_clean();
$findme = "Physical";
$pmac = strpos($mycom, $findme);
$mac=substr($mycom,($pmac+36),17);
echo $mac;
Mahesh
  • 1
  • After removing the ob* also no result – Mahesh Dec 03 '19 at 10:49
  • What's in `$mycom`?, presuming your *cloud server* is running windows and has ipconfig installed. – Lawrence Cherone Dec 03 '19 at 10:53
  • *"How can I get the clients MAC address in PHP...?*" - short answer, you can't (in general). – CD001 Dec 03 '19 at 10:59
  • Cloud server in running on Linux – Mahesh Dec 03 '19 at 11:00
  • Does this answer your question? [How to get MAC address of client using PHP?](https://stackoverflow.com/questions/5074139/how-to-get-mac-address-of-client-using-php) – CD001 Dec 03 '19 at 11:00
  • Also [this](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) - PHP runs on the server so running a `system('ip a)` command will merely give you information about the server, **not** the client. – CD001 Dec 03 '19 at 11:02
  • Okay. So, how can get the MAC address of a client machine? – Mahesh Dec 03 '19 at 11:05
  • (How to get MAC address of client using PHP?) is not helpfull for me – Mahesh Dec 03 '19 at 12:14

0 Answers0