How-To: Control iTunes from any web browser
For today's how-to we're going to set up a simple web server in XP so that we can control iTunes remotely. Engadget reader Jordan Parker was tired of having to walk into the other room to change tracks so he put together the PHP script we'll be using. The page it generates should be usable on any device with a web browser. Similar solutions exist for OS X. Click on to get the full skinny — it's worth your time, promise!
The first thing you need to do is download this zip file
containing the PHP and image files. Unzip it in a directory you can find later.
Next youll need to install a web server. Were using BRS WebWeaver since it is really lightweight, approximately
375KB. Download
BRS WebWeaver here. The install is straightforward and you wont need to change any of the defaults.
PHP is the next piece that needs to be added. Download the PHP 5.1.1 installer. The installer will ask you which HTTP server you would like to configure. Since BRS WebWeaver isnt on the list select None. We will configure it manually.
After the PHP install has completed, start BRS WebWeaver.
Select Options > Server Config. Click on HTTP Server in the tree. Use the button next to the Virtual Root text box to select the directory that you unzipped the PHP files to.
Now click on the + sign next to HTTP Server to expand the tree. Select PHP in the tree. Click the check box for Enable PHP Processing. For Location of PHP.EXE you need to navigate to the folder where PHP is installed. If you chose all of the defaults it will be located at c:\php\php-cgi.exe. Click Save.
Now click on File > Start HTTP Server. XP should generate a firewall warning since the web server is opening a port. Click Unblock.
Now the server is completely set up and ready to test out. First, open iTunes and start a song playing. Then, open a browser window and navigate to the front-end. Since you are on the same computer as iTunes, go to http://localhost/player.php. You should see an interface identical to the one at the top of this post. If it works move to a different computer on your network and try the test again, this time replacing localhost with the actual IP of the computer hosting iTunes (or its NetBIOS or DNS name, if you want to get fancy).
Wed like to thank Jordan Parker for his fine work. He said he thinks hes not the best PHP programmer and is interested in seeing what improvements and modifications others will make to his code, but we think he done good.


















Reader Comments (Page 1 of 2)
Andrew @ Dec 19th 2005 2:46AM
Link to the ZIP doesn't work.
John Mars @ Dec 19th 2005 2:46AM
maybe its just me, but the "download this file" link doesnt exist? it says it's http:///
ken fager @ Dec 19th 2005 2:46AM
Pretty handy stuff. I live in a dorm and my room is right next to the lounge. I controlled my iMac iTunes with my iBook when I threw a party in the lounge. Even on the Windows end this is pretty nifty.
Dave @ Dec 19th 2005 2:46AM
Am I the only one who operates iTunes and the iPod almost exclusively through the "browse" (by artist and then by album) feature? Without a browse, I'm sorry, but it's no good for me. That's why the Playlists menu on the iPod is useless for me as well -- It's just a list of songs with no artist or album information.
I'm guessing I must be the exception, or I would have heard other people complaining already (not in this thread but elsewhere).
GitsLM @ Dec 19th 2005 2:46AM
@4 same with me, I am also using the browse function and who cares about playlists ;)
Danny Purdue @ Dec 19th 2005 2:46AM
Network control of iTunes has long been available via Applescript on Mac's since day one. It's extremely easy to set up. For all you mac users, check out http://www.dougscripts.com for tons of scripts including network control.
John Reiser @ Dec 19th 2005 2:46AM
I have a similar solution for Mac OS X using perl and applescript. The problem with doing this on the Mac is that most sites found through Google recommend running apache as the console user, which is a potential security risk. My method is similar to Jordan's in that I have a slim web server running under my account with no privledges other than running the predefined commands to control iTunes (or anything else, for that matter) through AppleScript.
I have a brief write up of the program at my personal project site: http://projects.newrisedesigns.com/
I'm at work now, but I can post the perl and applescript code once I get home.
John
overratediPod @ Dec 19th 2005 2:46AM
oh boy, here you go again egadget hawking another apple related product. showing once again your apple bias - what is this, c|net? jump on in apple fanboys and enjoy it while you can, because soon the zen vision:M will come out and expose you all for the idiot lemmings you are. suckers.
khamel @ Dec 19th 2005 2:46AM
is overratediPod's post supposed to be ironic? i'm confused. i guess being a zen lemming is better than being an ipod lemming, the zen lemmings jump off a waterfall cliff instead of those ipod water-less ones.
Urbanity @ Dec 19th 2005 2:46AM
Link to the ZIP doesn't work. :(
Saif @ Dec 19th 2005 2:46AM
I think overratediPod was being sarcastic or ironic, because there's no way you can have a gadget/technology weblog that claims to provide any kind of comprehensive coverage without ever *mentioning* an Apple product.
Tupper @ Dec 19th 2005 2:46AM
This is cool, thanks engadget.
torkhum @ Dec 19th 2005 2:46AM
NICE. Finally someone with a brain. Awsome.
underratediPod @ Dec 19th 2005 2:46AM
Ooh i can hardly wait for the zen vision:M
That was ironic by the way
Logan @ Dec 19th 2005 2:46AM
Is there anyway for this to work on a psp on its web browser???
Jason @ Dec 19th 2005 2:46AM
Why not just install itunes on the other machines on the network.? I am not sure I see the benefit..
billyfat @ Dec 19th 2005 2:46AM
I use Remote Administrator(radmin.com) to run my main computer from my laptop in the next room. That way I don't need a special script for every single application I want to control remotely. The server side uses up at most about 10 percent of the cpu.
BDC @ Dec 19th 2005 2:46AM
Logan,
mentioned previously on Engadget:
http://www.coverbuddy.com/
Dave @ Dec 19th 2005 2:46AM
#15, because the computer most conveniently close to you might not be the same as the computer hooked up directly to your sweet-ass stereo system. Also, that nearby computer might be a laptop that you just want to open up, select a song, and then close up and put back to sleep (at which point of course it can no longer play music). So it does have some value, I think.
Dave @ Dec 19th 2005 2:46AM
And also, I see no reason why it wouldn't work on a PSP browser. That's a pretty sweet use for this (aside from the lack of Browse capability I discussed earlier).
Eliot Phillips @ Dec 19th 2005 2:46AM
overratediPod enjoys jacking comment threads:
http://portableaudio.engadget.com/entry/1234000460072252/#comments
I'm not really sure how fixing product shortcomings makes us Apple shills.
Dave and overratediPod have the same IP address so something more sinister/obnoxious is going on here.
presando @ Dec 19th 2005 2:46AM
Sweet!!!!. Apple has always been better than MS-fact,
Matt @ Dec 19th 2005 2:46AM
And something that's infinitely easier to set up for winamp: ml_www. http://sourceforge.net/projects/mlwww/
Not only can you control your music from the web, you can also download/stream it! Looks like it hasn't been updated in a while, but it works.
Trevor @ Dec 19th 2005 2:46AM
This only works for local computers?
not from my treo?
Steven @ Dec 19th 2005 2:46AM
a long time ago I was experimenting with ajax, and wrote a php ajax script that used xml-rpc to connect to a little python script on another machine which controlled itunes through COM...I already had a linux web server and a windows machine with itunes, so I connected them. It was pretty ghetto but it was nicer to use than this (no refreshing cause of ajax). I think i threw it away though.
MakTheYak @ Dec 19th 2005 2:46AM
Anyone got this working with Apache yet? I already have it running on my machine but I get
Warning: (null)(): Unable to obtain IDispatch interface for CLSID {DC0C2640-1415-4644-875C-6F4D769839BA}: Server execution failed in c:all workwebitunesplayer.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in c:all workwebitunesplayer.php on line 2
...when I try to use it. Ideas?
John M @ Dec 19th 2005 2:46AM
i keep getting a page that says "404 error the requested url is not available on this server"
Esch @ Dec 19th 2005 2:46AM
Apache kind of seems like overkill just to control iTunes. I found it far simpler to just write a python script to run a small webserver in order to control iTunes + anything else, as it seems other people on here have found as well.
John M @ Dec 19th 2005 2:46AM
i keep getting a page that says "404 error the requested url is not available on this server"
Ben brenker @ Dec 19th 2005 2:46AM
Add my thanks to the list, Lords of Acid via remote control? Oh hell yeah!
J.Allard @ Dec 19th 2005 2:46AM
If you have Firefox as your web browser you can controll just about any music program including iTunes. The program you need to download is called FoxyTunes. You can get it at www.foxytunes.com. I just love it! You can even download some skins for it!
Mike @ Dec 19th 2005 2:46AM
If only windows has a built in server! =P
Damen Gilland @ Dec 19th 2005 2:46AM
"Why not just install itunes on the other machines on the network.? I am not sure I see the benefit.." Exactly. iTunes will let you share your music library, you can even password protect it. This is the most useless gimic I've ever seen on Engadet -- don't praise people for remaking things that software already does. The only advantage I see to this is that it will let you manage iTunes from a computer on a different wireless network... Um, guessing that most people aren't going to want to do that.
Seth @ Dec 19th 2005 2:46AM
Am I wrong here, is it just stop/foward/back functionality?
And you need to physically start the first mp3 at your machine?
Seems limited :(
Jason Johnson @ Dec 19th 2005 2:46AM
This is just what I've been looking for. My Media Center PC is connected to my stereo system. Until now I've had to use Windows Media Player which I can control remotely with Niveus PocketPC Remote. Now I can use iTunes and control it from other PCs in my house.
Daryn @ Dec 19th 2005 2:46AM
Here are some links that instruct on how to setup access in iTunes of remote libraries over the internet. I've done this to access my home library while I'm at work. My home computer is a mac and my work computer is a Win XP machine.
Mac: http://www.codewitch.org/archives/2005/04/sharing_itunes.html
Windows: http://www.sevitz.com/blog/2005/03/how_to_share_your_music_via_itunes_on_the_net.asp
Embassy @ Dec 19th 2005 2:46AM
To all the people asking if this works with the PSP web browser, then yes, it does. Just make sure you change the cache option to 'Do Not Use', otherwise after you have pressed a button once it won't work anymore as the PSP is just reloading the page from it's cache.
Hiptrigger @ Dec 19th 2005 2:46AM
16, 30 & 31 - wow are you shortsighted, no, make that dumb - do you always post comments about how useless something is just because you can't fathom the use case? Or can't see why the use case isn't 'all about you'?
This use case is where the sound system is hooked to another computer at some distance (not necessarily same OS or has iTunes share capability with the machine you are sitting at.) Nice to change tunes/netradio from across the office without interupting one's work. Assuming one is old enough/competent enough to be gainfully employed. At my last office we had a older machine dedicated to the voicemail system, the sound system for everyone and some other general office functions. No one sat at that machine. The remote control I had in place was good to combat the marketing chicas always dialing-in lame-o 80's music.
Kudos to engadet for making an effort, unlike the pathetic whiners who criticize every little thing. And yes I am criticizing the whiners --please blow it out your, ya well, perhaps a bulb will flicker and you can figure out the rest.
Hiptrigger @ Dec 19th 2005 2:46AM
16, 30 & 31 - wow are you shortsighted, no, make that dumb - do you always post comments about how useless something is just because you can't fathom the use case? Or can't see why the use case isn't 'all about you'?
This use case is where the sound system is hooked to another computer at some distance (not necessarily same OS or has iTunes share capability with the machine you are sitting at.) Nice to change tunes/netradio from across the office without interupting one's work. Assuming one is old enough/competent enough to be gainfully employed. At my last office we had a older machine dedicated to the voicemail system, the sound system for everyone and some other general office functions. No one sat at that machine. The remote control I had in place was good to combat the marketing chicas always dialing-in lame-o 80's music.
Kudos to engadet for making an effort, unlike the pathetic whiners who criticize every little thing. And yes I am criticizing the whiners --please blow it out your, ya well, perhaps a bulb will flicker and you can figure out the rest.
Tonicboy @ Dec 19th 2005 2:46AM
I can't seem to get this to work. I'm running PHP 5.11 on top of Apache 2.2. It's not WebWeaver, but my other PHP apps work fine. The problem seems to be in instantiating the COM object. Anyone else had any luck?
Nepthar @ Dec 19th 2005 2:46AM
TO APACHE USERS - Unfortunately, there's some strange problem with apache and PHP permissions (ie. php not being able to create COM objects). I found a tutorial online for how to fix this, but it didn't work. I think if you re-install PHP as the .exe file instead of the apache plugin, it might work.
Seth @ Dec 19th 2005 2:46AM
Hiptrigger,
First off, you seem pretty smart there with the double post.
I've read about other solutions that have far greater functionality, so skipping ahead one song is very limited.
I'm setting up a touchscreen device and would like it control itunes on another pc, not just skip one song at a time. Any other solutions out there, like coverbuddy?
Tonicboy @ Dec 19th 2005 2:46AM
Guys,
Apple has exposed pretty much every functionality you could want to control in iTunes through the iTunes COM SDK (http://developer.apple.com/sdk/itunescomsdk.html). It's just a matter of putting in the time to develop the application that actually makes use of all of it. My problem right now is that I can't get PHP to even instantiate the COM object.
oxgate @ Dec 19th 2005 2:46AM
Pretty cool. It's a little flaky in the browser on my WiFi enabled PPC, but if I can get it working better it will make a nice remote!
Alejandro @ Dec 19th 2005 2:46AM
All this setup time just to control iTunes. I suggest getting Firefox!!!! Then download the FoxyTunes Extention, and you are ready to go!!! It is much easier than installing web server capabilities to your computer!
Tony @ Dec 19th 2005 2:46AM
tried installing this with apachefrieds lite, and no dice. Apache works, php is configured, but i get the pretty itunes looking remote with this:
Fatal error: Call to a member function Name() on a non-object in C:apachefriendsxampplitehtdocsitunesplayer.php on line 47
anyone get this working with any web server??
Carl @ Dec 19th 2005 2:46AM
Alejandro: Foxytunes will not let you control iTunes from another room! I doubt anyone is setting all this up just to control iTunes on the one PC.
Alex Brewer @ Dec 19th 2005 2:46AM
SWEET! It does work from the psp! It works perfectly! I can't wait to screw around with my dad when he's trying to listen to music on the comp!
Alex Brewer @ Dec 19th 2005 2:46AM
SWEET! It does work from the psp! It works perfectly! I can't wait to screw around with my dad when he's trying to listen to music on the comp!
PaulGanguly @ Dec 19th 2005 2:46AM
if you replace "localhost" in the url with your IP address (assuming you're not behind a router) it will work using any internet connection. I've had some friends test it, and they have been able to control my iTunes from their computers.
I see this having tremendous prank implications.
Does anyone know anything about streaming music, radio-style, from iTunes? That would be great.