Debugging a script executed by a remote server

I have written a PHP script which must be executed by a third party. For the sake of keeping this post short and simple, I won’t bother explaining why.

The problem is that I have never done this before, and I do not know how to test and debug the script without the ability to run it myself.

For starters, how can I dump any output from the script to a file on my server?