[popen](http://php.net/popen) might help.