How can I get whole page contents after that page redirect by javascript?

In **executewebpage.php**:

```
<?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'=>'true','trigger'=>'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);

```

How can I get contents of **http://www.finalpage.com**?

**Note:If I don't echo, it don't return anything and don't redirect to any page**

Thank you so much!