title: PHP CURL response time bypass
body: <p>I have an CURL request, where at times, and also depending on the request load, it takes minutes to receive response from the API, due to processing and calculations.</p>
  
  <p>For sake of good user experience, this behavior is undesired to have.
  While waiting for response, sometimes long time, user is unable to perform any functions on the website.</p>
  
  <p>So I am looking for solutions on how to go by doing it so the user can use the application while this application waits for results from API.</p>
  
  <p>Solutions I have already considered.</p>
  
  <ol>
  <li><p>Recording the request and using cron job to process it.
  Unfortunately there is couple of pitfalls to that.
  -Need of running a cron job every minute or constantly.
  -Situations when user request is minimal or API is super fast at the moment, entire request may only take 2-3 seconds. But when using cron and it was requested let's say 30 seconds ahead of time for next cron job run, you end up with result of 32 second turn around.
  So this solution may improve some, and worsen some, not sure if I really like that.</p></li>
  <li><p>Aborting CURL request after few seconds.
  Although the API sends separate response to url endpoint of my choice, and it seems safe to terminate transmission after posting request, there might be situation when those few seconds may not be enough time to even establish the connection with API. I guess what I am trying to say is that, with terminating CURL I have no way of knowing if the actual request made it through.</p></li>
  </ol>
  
  <p>Is there another approach that I could consider?
  Thank you.</p>