Executing applescript via web page
I have written a simple Applescript which changes the Airplay speakers in iTunes. This works fine if executed from the command line using osascript or by executing an app version of the script. However, I need a way to execute this script or app remotely via apache. In other words I want to be able to go to a URL that has the effect of switching the speakers. It appears that this is not possible as I find that using PHP or Python to execute the osascript or the app results in a -10810 error. I presume this is because I am trying to get apache to run a script which is dependent on a logged in user's running copy of iTunes. If this is not possible can anyone suggest a way to accomplish the speaker switch remotely?