Jump to content

php access external program? is it possible


Dragen

Recommended Posts

This'll probably be a no, but is php able to access external programs such as windows media player?

 

I'm just wanting to make a script that wil randomly pause the current song, then start again when a link is clicked.

If not, what type of scripting should I look into?

Link to comment
Share on other sites

I think you can use www.php.net/system or www.php.net/exec  I am not sure if it works on Windows, I know it works on Linux. But you would have to use command line options or create a type of batch/macro or your own program that does the switching of songs for you.

Link to comment
Share on other sites

thanks for those links frost.

To be honest I think it's a bit over my head.. I didn't understand much of what it said.

I'm not wanting to display anything in the php file except a link wich will play the song.

 

I need the php file to access windos media player and after a random time, pause the playing of whatever track it is. Then when you click a link it starts the playing again.

 

I read the example for system() and didn't get it..

// Outputs all the result of shellcommand "ls", and returns

To sound stupid.. what's a shell command?

Link to comment
Share on other sites

Shell is part of the Linux Enviroment, kind of like DOS but much more powerful and userfriendly. That is why I said I am not sure if it would work or not, more or less the exec function is what you are looking for.

 

I would suggest reading up on Windows Media Player and see if they are command line functions. If so you will need those to code something like

 

<?php
if (isset($_POST['next'])) {
       exec('wmplayer.exe -fNextSong -pPlay');
}
?>

 

Now what i posted above WILL NOT WORK, just an example of what you MIGHT need to pass. I am sure a googling might do you good. Let us know what you find if anything.

Link to comment
Share on other sites

I do not think it listed all functions, try /pause before you give up completely. Remember you can test these in the command prompt (Start > Run > cmd)

 

Before you try implementing them in the script.

Link to comment
Share on other sites

okay.. I've never tried using this before.. I've opened up cmd.exe and I guess I need to type in the path to windows media player?

problem is it has a path typed in which I can't edit which is:

C:\Documents and Settings\myusername>

Not quite sure how to connect it to windows media player

Link to comment
Share on other sites

okay I've contacted my host and they say that they wont enable exec()...

 

Is there anything else I could try? I'm probably going to have to look into non-web script such as c++ or something..

I just wanted something quick to do and wanted it by Sunday.. oh well.

Link to comment
Share on other sites

One thing you could do, is potentially create a program on your side that accepts incoming connection, maybe start up a localhost server and use no-ip.com to get you an ip and deny all ip addresses except the one that should be coming in on your server. From there you should be able to run the exec command. Just an idea.

Link to comment
Share on other sites

exec and the like run on the server, just like php. Sounds to me like you want to interact with programs on the client. This is not possible with php because it runs on the server.

 

You'll need either an ActiveX component or something similar.

Link to comment
Share on other sites

that's going to mean learning c++ or VB Script though...

ah well.. unless someone can link me to a script which already does what I need I'll have to forget about it. I needed it for sunday and haven't the time to learn c++ is one day :P I doubt anyone has.

 

Thanks for all the advice anyway

Link to comment
Share on other sites

I literrally waqnt something to access windows media player itself and pause files at random intervals, with a button to resume play.

 

It's not neccessarily for a website, just something I wanted to do.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.