Re: [PHP-GTK] redirecting external program output
[email protected] (Rasmus Lerdorf) Sun, 12 Aug 2001 09:01:41 -0700 (PDT)
| Newsgroups | php.gtk |
|---|---|
| Message-ID | <[email protected]> |
> 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:[email protected]:/repository login
Password: phpfi
cvs -d:pserver:[email protected]:/repository co pear/XMMS
Then follow the README
You can also see it in action at http://lerdorf.com/xmms.php
-Rasmus