Monday , 25 September 2023
Breaking News
Home > Tutorials > PHP > How to get MAC and IP address of Windows System with PHP

How to get MAC and IP address of Windows System with PHP


Friends today I am going to that ‘How to get MAC address and IP address of Windows”. Trick is very simple, you have to run ‘ipconfig/all’ command through ‘System’ programme and then you will capture output and save into variable with ‘ob_get_contents()’ function. It will  return you an array and from this array you have to pull out your MAC address by search a word “Physical”. Now with “strpos()” and “substr()” function you will get your required MAC address.

Here is code:-

Now lets move to our next step. You need IP address of your host. It is very simple function.

You can write functions for both tricks. You can use these functions anywhere as per your need. Here is function for MAC address:-

and call this function like this


As you can see it is very simple. No need to explain.

Have a nice coding. Meet you in next tutorial.

About Muhammad Faryad

Muhammad Faryad is a professional web application developer. He has been working for 5 years in ICE786 Technologies Pvt. Ltd as a Senior Programmer and Developer. You can contact him on facebook at


  1. how to get my system config in php

Leave a Reply to Muhammad Faryad Cancel reply

Ad Test

%d bloggers like this: