title: Using CURL - Post and redirect help
body: <p>I've been banging my head against a wall for a few hours now - and it's probably something really obvious I've missed!</p>
  
  <p>I'm trying to connect to a payment service provider (PSP) using CURL, post data and follow the post so the user actually ends up on the PSP's site.</p>
  
  <p>Using the following:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://psp.com/theirpage');
  curl_setopt($ch, CURLOPT_REFERER,  "http://mysite.com/mypage");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
  curl_setopt($ch, CURLOPT_POST, 1);
  $result=curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>This successfully connects, verifies the data I've passed, but instead of redirecting the user to the PSP, it just loads the HTML on my site. Safe mode is off, and open_basedir is blank.</p>
  
  <p>What am I doing wrong?</p>