Php And Iptables
hi,
<? echo exec ("sudo ifconfig"); ?> when i run this command in php it works fine, but i want to be able to "echo" the information onto php screen? i am not to sure how to do this? could someone shed some light please? Rich. |
See
http://php.net/manual/en/function.exec.php You need to give exec() a variable to store the output of the command. After exec(), you can then print this variable using standard PhP echo/print functions. The passthru() function automatically prints the output of the command. http://php.net/manual/en/function.passthru.php http://php.net/manual/en/ref.exec.php contains a bunch of links to PhP commands regarding execution of programs that are external to PhP (ie via the shell). In short, if you're working on PhP, http://php.net is a great reference. |
thanks,
exec(('sudo ifconfig'),$output); This is what i have to store the array, in short do you know the command to print this array, im having trouble understanding the links? |
I quickly looked it up on php.net.
The command is called "print" and supports arrays (ie multiline output). For examples, open up http://php.net in a browser and type in the search box (top right on the page). It'll take you directly to the "print" command syntax. |
All times are GMT -5. The time now is 07:16 PM. |