I have an application in which I change the data on web and then download the files then I compile my iPhone app with data. I just want to create ad-hoc distribution so I have already added devices. So is there a way that anytime I change data on web then I compile my iPhone app over the server using PHP and some command-line script so that I create a ready-made ipa and user can install the application using iTunes? Also is it possible to compile on Windows?
Also how do we change ad hoc provision profile? I mean where we can set code sign?

How do we invoke terminal and run command xcodebuild using PHP? Suppose we have mac server then how we invoke terminal and then navigate to project directory and run xcodebuild command?