title: Unable to redirect from Drupal to PayPal
body: <p>I'm totally new to Drupal. I created a form in Drupal using pure HTML when the user clicks on pay I call a PHP file just to get some database information subsequently this PHP redirects to another PHP that puts the PayPal payment together.</p>
  
  <p>For some reason the PayPal payment PHP does not redirect to PayPal when it is called from under Drupal. My layers are as follows:</p>
  
  <p><a href="https://example.com/test/?q=node/11" rel="nofollow noreferrer">https://example.com/test/?q=node/11</a> --> call savedatatoDB.php --> call paypalpreparepayment.php --> redirect to paypal</p>
  
  <p>If I call the PayPal payment PHP from the browser directly like this:
  <a href="https://example.com/test/paypal/restapi/sample/payments/PaymentPP.php?samount=0.005&amp;sprice=123.45&amp;description=products&amp;sqty=100" rel="nofollow noreferrer">https://example.com/test/paypal/restapi/sample/payments/PaymentPP.php?samount=0.005&amp;sprice=123.45&amp;description=products&amp;sqty=100</a></p>
  
  <p>it works! I thought the problem could be an output before header() but it is not the case.</p>
  
  <p>I wrote a line to write to a log file right before the redirect like this:</p>
  
  <pre><code>$today = date("D M j G:i:s T Y");               // Sat Mar 10 17:16:18 MST 2001
  $log = "{$today} ready to redirect {$sale_description}, {$sale_amount}, {$sale_quantity}, {$sale_price}\n";
  //Save string to log, use FILE_APPEND to append.
  file_put_contents('./log_'.date("j.n.Y").'.txt', $log, FILE_APPEND);
  header("Location: $redirectUrl");
  exit;
  </code></pre>
  
  <p>And the log shows that I'm getting that far but no redirect! but again if I call that PHP directly from the browser then I see PayPal asking me to authorize.</p>
  
  <p>So when I'm under Drupal UI, I'm wondering if Drupal could be blocking the redirect somehow.</p>