I want to invoke a program on the webpage and get it output on the webpage. Actually I have a packet sniffer in C language and I am executing it using exec commnd in php.
exec('sniffer');
but the thing is it shows an error “Unable to make file.” and also I need as the program runs in background I should get an updated output, i.e. I want that as program modifies the output while running the output on the webpage should be refreshed to the current output.
For example:
When I start the program the output is : TCP:16
Now after 2 sec of program execution o/p changes to ‘TCP:32’.
So it should refresh ‘TCP:32’ on the same page instead of ‘TCP:16’.
Can anyone help??
exec is not supposed to do what you want, use passthru instead.
http://www.php.net/manual/en/function.passthru.php
http://www.php.net/manual/en/function.exec.php