Possible Duplicate:
Call a C program from php and read program output
How can I run a C/Java/Python/etc. program when using PHP?
Possible Duplicate:
Call a C program from php and read program output
How can I run a C/Java/Python/etc. program when using PHP?
Use popen() function. This will grant you access to stdout or stdin, but only one of them.
So, python application:
$handle = popen('python /home/user/Documents/somefile.py', 'r');
var_dump(fread($handle));
pclose($handle);
But if you need to use both stdin and stdout - you should take a look at proc_open().