I have created an API that is used on several sites. The client sites call the server with either file_get_contents or curl and accesses a url of ours like "http://www.myserver.com/api/record.php?some=thing". The client makes the call and then waits for the API to respond before processing the rest of the page. However, some of the time no output from the API is needed by the client.
I'm wondering if there's a way for the server to output something so that the client doesn't wait for it while the server process is executing what it needs to do. Something like 'page done', so the client doesn't wait for it to load anymore, but the server script is still running for a second while it inserts database entries.
I've read that the process control functions are for CLI use only and should not be used in a web server environment, so spawning a new process is out of the question.
Any suggestions? I know making the call asynchronously with javascript would work, but we've found PHP accesses to be must more reliable than JS.
Thanks so much!