title: Paypal PDT script not working using cURL
body: <p>I can't seem to get this PayPal PDT script working. PayPal hits the return URL but then I'm presented with a blank screen and nothing happens. Can anyone see what is incorrect? Here's my code:</p>
  
  <pre><code>$tx = $_GET['tx'];
  $ID = $_GET['cm'];
  $amount = $_GET['amt'];
  $currency = $_GET['cc'];
  $identity = '###########################################'; 
  
  // Init cURL
  $ch = curl_init(); 
  
  // Set request options
  $url = 'https:www.paypal.com/cgi-bin/webscr';
  $fields = array(
      'cmd' =&gt; '_notify-synch',
      'tx' =&gt; $tx,
      'at' =&gt; $identity,
  );
  
  curl_setopt($ch,CURLOPT_URL, $url);
  curl_setopt($ch,CURLOPT_POST, count($fields));
  curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch,CURLOPT_HEADER, FALSE);
  
  // Execute request and get response and status code
  $response = curl_exec($ch);
  $status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  
  // Close connection
  curl_close($ch);
  if($status == 200 AND strpos($response, 'SUCCESS') === 0)
  {
      wp_redirect(home_url('/account'));
      exit;
  } else {
      wp_redirect(home_url());
      exit;
  }
  </code></pre>
  
  <p>The URL string shows that the necessary information initially being returned (transaction ID etc) is correct but I don't know if it's actually being used but simply failing with the wordpress redirects or if it's failing at some point beforehand.</p>