Click to See Complete Forum and Search --> : is there a PHP function that would run an audio file


Salam
08-31-2003, 11:31 PM
Hi, is there a way to run audio files from PHP code without having an html window open on the user's PC but just have the audio program like real player open to play the audio file

Thanks,
Salam

brendandonhue
09-01-2003, 07:14 PM
No, it would be a security risk to allow you to run programs on other people's computers.

What is wrong with just embedding the file in HTML anyway?

Salam
09-01-2003, 09:02 PM
Hi, I did not mean runing a program on the user's PC. I want to write a PHP file that runs the adio file that is on my server without having to return the address of the audio file within html code to the user's PC. So the user will click a link on a one of my pages. The link is to a PHP file. The PHP file just causes an adio file on my server to play for the user.

Thanks,
Salam

PunkSktBrdr01
09-01-2003, 09:07 PM
As far as I know, there is no way to play the audio file without exposing it's location. The only thing that you could do in PHP would be to redirect the user to the file, but I don't think that's what you're looking for. Try posting in the JavaScript section. You could probably include a javascript file that contains a function to play the audio file. Hope that helps!

Salam
09-01-2003, 10:53 PM
Hi PunkSktBrdr01, actually I do not think that the javascript trick will help because it runs on the user's PC and thus the audio file's link will be exposed :)

Salam

brendandonhue
09-02-2003, 05:18 AM
Ok, I understand what you mean a bit better now.
I don't think you can actually play the audio file directly using PHP, as PHP generates HTML, which would have to contain the URL of the sound file.
If you tell us the purpose of hiding the URL of the audio, maybe we can find another method. Is it so the user can't download or copy the file?

PunkSktBrdr01
09-02-2003, 06:05 AM
Actually, I think the JavaScript thing might work. I didn't mean using include(), but using <script language="JavaScript" type="text/javascript" src="file.js">. It would still be exposed in the "file.js" file, but if you add a lot of other code in the file, it would be hard to find. I doubt there is a way to completely hide the location of the file, though, because the user's computer needs to know where the file is to request it and play it.

Salam
09-02-2003, 10:08 AM
Hi brendandonhue, yes the reason is to prevent the possibility of downloading a copy of the file.

Hi, PunkSktBrdr01, I agree with you on what you wrote. That will make it hard for most people to figure out.

Thanks,
Salam

brendandonhue
09-02-2003, 02:29 PM
Maybe there is some possibility you can use a streaming server such as SHOUTCast or Darwin? That would stop people from directly downloading the files, but im not really an expert in this area.

Khalid Ali
09-02-2003, 05:24 PM
Yes it will stop direct download of course.
But htey still can capture any audio/video coming out of their audio/video card.....why bother going thru this much hastle while you can not stop it... huh????

brendandonhue
09-02-2003, 05:38 PM
Yes, I know they can capture it using many free programs that capture sound directly from the sound card, but I'm not sure that is the issue here.....maybe it is. Using a streaming server will stop most casual downloaders though...

Salam
09-03-2003, 06:06 PM
Thanks for all of you who have responded :) I just was hopping there is simply a PHP function call. Its not worth it if its more complecated than that.

Thank you all
Salam