On www.a.com in the page that handles the post data you can do something similar to this:
$url = 'www.b.com/sub.php';
$fields = array(
'name' => urlencode( $_POST['name'] ),
'address' => urlencode( $_POST['address'] ),
'format' => urlencode( $_POST['format'] ),
'emailid' => urlencode( $_POST['emailid'] )
);
foreach($fields as $key=>$value) { $query .= $key.'='.$value.'&'; }
rtrim($query,'&');
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, count( $fields ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $query );
curl_exec( $ch );
curl_close( $ch );
Then on www.b.com just handle it like a regular POST request.
Credit: http://davidwalsh.name/execute-http-post-php-curl