I want to send the http status (200 OK) to a calling script BEFORE the rest of the code executes in a php script. For sending the status code, i am using HTTP/1.1 200 OK but it is sending the status AFTER the entire script is finished executing, which makes the calling script to wait. I am not really sure if that is even possible. any help?
Detailed: say i have two scripts, a.php and b.php. a.php is calling b.php and waiting for a http status, if it is 200 then it carries on doing something else. I want the b.php script to be such that, as soon as it is called, it sends back a 200 response and then continues with its own code.
Thanks!
Edit: After reading the comments, i understood that what i wanted to do is a bad idea. However, let me say why i was thinking it and can something like that be done.
a.php would have a web interface where people can upload their images, after the upload is done a.php calls b.php which does some processing using these images. I wanted a.php to continue and not hang/wait for b.php to finish, in case b.php fails, I thought i might be able to "push" a error so that a.php can prompt the user about the failure. Should different threads be used?