title: How do I prevent to be redirected with PHP cURL
body: <p>I'm developing a form in which requires to submit the collected data to a third party website, in the form of: <a href="http://www.domain.com/page?key=value&amp;key2=value2" rel="noreferrer">http://www.domain.com/page?key=value&amp;key2=value2</a></p>
  
  <p>I decide to use cURL as I have not found an alternative that convince me. </p>
  
  <p>The problem that I'm running is that once the form is submitted, cURL is executed but I'm being redirected to the domain that I specified. Instead, I want to redirect the user to a confirmation page within my domain and not to the third party website.</p>
  
  <p>Here is an example of the code that I'm using:</p>
  
  <pre><code>$URL="otherserver.domain.com";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,"http://$URL"); 
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, "key=value2&amp;key2=value2&amp;key3=value3");
  curl_exec($ch);
  $info = curl_getinfo($ch);
  curl_close ($ch);
  </code></pre>
  
  <p>How can I prevent from being redirected to otherserver.domain.com?</p>
  
  <p>Please feel free to let me know if you think that instead of using cURL, there is a better way to submit the data to the third party website.</p>
  
  <p>Thank you all in advance </p>