Dragen Posted May 23, 2007 Share Posted May 23, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/ Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260290 Share on other sites More sharing options...
Dragen Posted May 23, 2007 Author Share Posted May 23, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260299 Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260301 Share on other sites More sharing options...
Dragen Posted May 23, 2007 Author Share Posted May 23, 2007 thanks, Just done a quick google search and it does support command lines (I get what command lines are now...) http://support.microsoft.com/KB/241422 But it doesn't seem to have a pause function, so I guess it wouldn't work. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260311 Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260315 Share on other sites More sharing options...
Dragen Posted May 23, 2007 Author Share Posted May 23, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260321 Share on other sites More sharing options...
Dragen Posted May 23, 2007 Author Share Posted May 23, 2007 ah.. nevermind about exec().. I just tried testing an exec command (which was probably wrong..) and my server has exec disabled. I might try and contact them about it. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260351 Share on other sites More sharing options...
Dragen Posted May 24, 2007 Author Share Posted May 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-260639 Share on other sites More sharing options...
per1os Posted May 24, 2007 Share Posted May 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261171 Share on other sites More sharing options...
Dragen Posted May 24, 2007 Author Share Posted May 24, 2007 I've got no idea how to set up local hosts.. Is there a good tutorial or something about it? Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261172 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261182 Share on other sites More sharing options...
Dragen Posted May 25, 2007 Author Share Posted May 25, 2007 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 I doubt anyone has. Thanks for all the advice anyway Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261191 Share on other sites More sharing options...
trq Posted May 25, 2007 Share Posted May 25, 2007 What exactly do you want? You may be able to find a flash media player that you could embed into your pages. Its not real clear exactly what your wanting to do. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261202 Share on other sites More sharing options...
Dragen Posted May 25, 2007 Author Share Posted May 25, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/52712-php-access-external-program-is-it-possible/#findComment-261441 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.