What you need is to know how to manupilate strings!
<?php
exec("mylinuxcmd", $exitVals);
?>
for run a command, just use:
where $exitVals is na Array with the terminal output or the "mylinuxcmd", each line of output is stored in an array position!
This is an example of catching server IP`s and print them on screen:
<?php
// exec ifconfig linux command and catch exit on $arr
exec("ifconfig", $arr);
foreach($arr as $ar) {
if(strstr($ar,'inet ')){
if(!strstr($ar,'127.0.0.1')){
$a = explode (' ',$ar);
echo $a[1]."\r\n";
}
}
}
?>
Depending on your sistem ifconfig, the ip can be in different place, so $a[1] can be $a[2], etc