The return code of the script your running will define the state of your command line switch.
In your case it’s a php script so start by looking at the exit function
How your going to get curl to return that code is beyond on the other hand.
I didn’t think of that. Good solution.
Would you mind making a sanitized version of it and sharing it with the rest of the community? Maybe under the Share your projects category.