Call the script from an Ajax call. It won't change anything on the page, it will just call that script and wait for its output, then you can do whatever you want with that.
Unfortunately, PHP does not natively support forking processes in the background for stuff like this, so you don't have a lot of choice.