php cURL didn't received data
<p>I have a page <code>a.php</code> that uses cURL to post data to <code>b.php</code> page.
However, when the page header to <code>b.php</code>, I didn't receive any POST data.</p>

<p>Here is my code:</p>

<pre><code>$data=array();
$data['firstname']='A';
$data['lastname']='B';

$post_str='';
foreach($data as $key=&gt;$value){
    $post_str.=$key.'='.urlencode($value).'&amp;';  
}

$post_str=substr($post_str, 0, -1);//Remove last &amp; from loop

$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/b.php');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

$response=curl_exec($ch);

curl_close($ch);
header('location:b.php');
</code></pre>

<p><strong>b.php page</strong></p>

<pre><code>echo $_POST['firstname'];
</code></pre>
