I use this code to understand some information of visitors (clients). It has been running on my virtual server on Xampp, but I can`t run on my main server (host). I see just a blank page.
$info = system('ipconfig /all');
echo $info;
I use this code to understand some information of visitors (clients). It has been running on my virtual server on Xampp, but I can`t run on my main server (host). I see just a blank page.
$info = system('ipconfig /all');
echo $info;
This would only get the servers IP information not the client. Because you are running the code on your local PC you will see your local information (which will be the same as the server information).
Also if your hosts server is running linux, the command would be ifconfig
, but that would still only get the server information.
Well, since you clarified that the server is linux based, the correct command on linux is
/sbin/ifconfig -a
The data returned will look slightly different
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 0000::000:0000:0000:0000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14141910 errors:0 dropped:0 overruns:0 frame:0
TX packets:6532919 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4462743134 (4.4 GB) TX bytes:1340503018 (1.3 GB)
Interrupt:22 Memory:f6ae0000-f6b00000
this might help you
Server IP
You can get the server IP address from
$_SERVER['SERVER_ADDR']
.Client IP address
You can get the client IP from
$_SERVER['REMOTE_ADDR']
Edit: you ask in comments how to get the output of an external command - one way is to use backticks, e.g.
But what if the client isn't on a LAN?
Well, you're out of luck unless you can have the client volunteer that information and transmit via other means. See Peter G Mac's suggestion for using Javascript.
you can also try following command