RE: [PHP-WIN] Running winamp thru php (was "executing an external program")

From: Date: Mon, 29 Apr 2002 03:48:21 +0000
Subject: RE: [PHP-WIN] Running winamp thru php (was "executing an external program")
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-13376@lists.php.net to get a copy of this message
Apparently this doesn't work on win2k though, and replacing the line with exec("CMD /C START c:\progra~1\winamp\winamp.exe \"$link\" >NUL"); I'm told doesn't seem to work. If anyone has suggestions, I'm open R -----Original Message----- From: Ross Fleming [mailto:r.fleming@totalise.co.uk] Sent: 29 April 2002 03:53 To: PHP Windows mailing list Subject: [PHP-WIN] Running winamp thru php (was "executing an external program") Since giving Ranier advice on external programs, I've knocked up a simple web-based interface for winamp that can be controlled over the internet (useful in a networked flat where one PC is simply a music box, I can leave apache running and remove the monitor/keyboard etc just to leave the box and the speakers). I'd started this project briefly a while ago (as some on the list may remember) but gave up. It works now, and I thought some people on the list would appreciate a look at it. (yes I know there are webbased winamp controllers available, but where's the fun in that?.. ;) ) Here's the php code for it <<contents of index.php>> <? $directory = "D:/mp3s"; // Set the directory we're looking at.. if (isset($filename)) { $link = "d:\\mp3s\\"; $link .= urldecode($filename); exec("COMMAND.COM /C START c:\progra~1\winamp\winamp.exe \"$link\" >NUL"); header("Location:index.php?status=playing&arg=$filename"); } if ($status=="playing") { $proper = urldecode($arg); echo "Now playing: <H3>$arg</H3>"; } $count=0; $handle=opendir($directory); echo "Choose a song to play from <B>$directory</B>:<BR>"; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (substr($file, -4)==".mp3"){ // ignore any non-mp3 files $filelist[$count++] = $file; } } } closedir($handle); sort ($filelist); // alphabetize the files for ($i=0; $i<$count; $i++) { $link = urlencode($filelist[$i]); echo "<A HREF=\"index.php?filename=$link\">$filelist[$i]</A><BR>"; } ?> Ross -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#13376) next »