title: PHP send POST request in separate thread and forget
body: <p>My app processes bookings, and upon process I would like it to send the booking details to whichever of my app's partners made the booking, so they can store a reference to the booking, <strong>AND</strong> without hold up the other processing my app has to do.</p>
  
  <p>I've thought about how to send a message to a partner, and my solution would be to send a cURL POST request to whichever of my partner's is making the booking <em>(besides answering my question maybe someone has a better solution than this?)</em>. </p>
  
  <p>Each partner would have a specific URL that they would setup to receive this POST request and store the booking information we send them.</p>
  
  <p><strong>THE PROBLEM:</strong>
  If we try send this POST request and their web server is slow or down then we may wait unnecessarily long to get a response, which in turn would delay the confirmation of the booking of the actual user making use of our service.</p>
  
  <p><strong>IDEAL SOLUTION:</strong>
  I would like to send this PHP cURL request in another thread so we can continue on our merry way and confirm the booking. If in the other thread there is a delay, this will not hold us up.</p>
  
  <p>Other solutions I have considered are:</p>
  
  <ul>
  <li>Calling an external script (e.g. written in python) to send this request. I've read that using <strong>exec()</strong> can be very resource intensive. We have lots of bookings so we would be sending lots of these booking POSTs. So ideally we need something resource conscience.</li>
  <li>Using sockets. I'm not familiar with the configuration of these and I'm worried about our socket server being down. It also feels like a mission to maintain. Maybe I'm wrong?</li>
  <li>Using a service like <a href="http://pusher.com/" rel="noreferrer">Pusher</a> which is effectively a socket service. The disadvantage is that if the listener misses a message they will never get it again. E.g. the partner would miss storing that booking.</li>
  </ul>
  
  <p>It would be great to get some feedback about what I'm trying to accomplish here, especially from someone that has been in need of a solution for the same kind of situation I'm in. Thanks for any help!</p>