Re: redirecting external program output
| From: | Rasmus Lerdorf | Date: | Sun, 12 Aug 2001 16:01:41 +0000 |
| Subject: | Re: redirecting external program output | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-2804@lists.php.net to get a copy of this message | ||
> I'm hoping that someone can help answer a problems that's been bugging me
> for some time now. How do I redirect the output from a program that I
> launch using either exec(), passthru(), or system() and allow PHP to
> continue running in the foreground? The programs in question are most
> likely going to be either XMMS or WinAmp, depending on the end users
> platform. Thanx for any input
You should be able to exec("program >somewhere &") and have it work.
However, both XMMS and I assume WinAmp (I don't do Windows) have better
ways to manipulate them. XMMS for example has a control socket protocol.
It will sit and listen to a UNIX-domain socket and you can query it and
manipulate it in many different ways. In fact, I just wrote a PHP
extension to do just that. I bet the same thing could be done for WinAmp
through the COM extension.
I also included a php-gtk test harness with this php-xmms extension. To
have a look at it, do this:
cvs -d:pserver:cvsread@cvs.php.net:/repository login
Password: phpfi
cvs -d:pserver:cvsread@cvs.php.net:/repository co pear/XMMS
Then follow the README
You can also see it in action at http://lerdorf.com/xmms.php
-Rasmus