title: POST data and redirect user by PHP CURL
body: <p>We need to redirect users to a URL and send some data to that URL (POST) with PHP CURL. Exactly like when a user click on HTML form submit with POST method.</p>
  
  <p>Our code is</p>
  
  <pre><code>$data=array("Token"=&gt;"test2","RedirectURL"=&gt;"test1");
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://sep.shaparak.ir/Payment.aspx');  
  curl_setopt($ch, CURLOPT_REFERER, 'https://sep.shaparak.ir/Payment.aspx'); 
  curl_setopt($ch, CURLOPT_HEADER, false);  
  curl_setopt($ch, CURLOPT_POST, 1);  
  curl_setopt($ch, CURLOPT_VERBOSE, false);  
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);  
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);  
  curl_setopt($ch, CURLOPT_POSTREDIR, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);  
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  
  curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  curl_exec($ch);
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>What is the solution?</p>