Hi guys, I need your help!
I have written a piece of code that creates a file titled "playlist.m3u". I want to further develop the code so that the file "playlist.m3u" will be automatically played as soon as it is created through winamp. I have tried to use the exec() and system() functions but I couldn't get it to work. Are there any other commands I should know of? This is the code I have written:
<?php
if(isset($_POST['action']) AND $_POST['action']=1){
$filename = "c:/Temp/playlist.m3u";
$m3u=fopen($filename, "w") or die("cannot open $filename");
$selected=$_POST['selected'];
foreach($selected as $file){
fwrite($m3u,$file."\r\n");
}
fclose($m3u);
echo exec($filename);
}
?>
Is there someone who can help me?
Thanks in advance!
How can I run a file from within PHP?
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
php/apache is probably running under the SYSTEM user, which doesn't have access (directly) to Winamp. If you set the service to have interactive access to the desktop, or switch the user it runs under to one that has access rights to the drives, I believe it'll work.. although it's been a while since I've screwed around with that stuff. 