I've done something similar. You basically get data then feed to CasperJS run. Some ways to do that is using exec PHP command directly, or you can set up some other PHP webservice which eventually still have to execute the command.
Output can be returned directly to calling PHP script or maybe write and read from file. However, there will be significant lag time while the whole process runs and results gets returned back. Normally is too long for good user experience, unless you design some other animation or status message to say nicely that you are collecting data in progress.
To invoke CasperJS + PhantomJS and depending on the number of automation steps, may take very long to return results.