title: PHP Close connection earlier which requested via CURL
body: <p>I have two script, request.php send a post request to receiver.php via PHP CURL, and I would like to close the connection and response to CURL immediately and continue running my script in background.</p>
  
  <p>Script below was unable to achieve my expectation, appreciate that someone able to provide a proper way to do this. Thank you so much~~~</p>
  
  <p>request.php</p>
  
  <pre><code>$curl = curl_init();
  curl_setopt_array($curl, array(
      CURLOPT_RETURNTRANSFER =&gt; 1,
      CURLOPT_URL =&gt; 'http://example.com/receiver.php',
      CURLOPT_POST =&gt; 1,
      CURLOPT_POSTFIELDS =&gt; http_build_query($params)
  ));
  curl_exec($curl);
  curl_close($curl);
  </code></pre>
  
  <p>receiver.php</p>
  
  <pre><code>ob_end_clean();
  header("Connection: close");
  ignore_user_abort(true);
  ob_start();
  echo('Text the user will see');
  $size = ob_get_length();
  header("Content-Length: $size");
  ob_end_flush();
  flush();
  
  sleep(30);
  echo('Text user will never see');
  </code></pre>