title: How to get page contents after redirect by javascript in php
body: <p>How can I get whole page contents after that page redirect by javascript?</p>
  
  <p>In <strong>executewebpage.php</strong>:</p>
  
  <pre><code>&lt;?php
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_HEADER, TRUE);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setOpt($ch, CURLOPT_POST, TRUE);
  $url = 'http://www.doredirect.com';
  $postfields = array('doredirect'=&gt;'true','trigger'=&gt;'1');
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  curl_setopt($ch, CURLOPT_URL, $url);
  $data = curl_exec($ch);
  
  echo($data);  //In this step, it redirect to page: http://www.finalpage.com
  
  curl_close($ch);
  </code></pre>
  
  <p>How can I get contents of <strong>http://www.finalpage.com</strong>?</p>
  
  <p><strong>Note:If I don't echo, it don't return anything and don't redirect to any page</strong></p>
  
  <p>Thank you so much!</p>