0 down vote favorite
Now i want to transverse POST data in a.com/a.php to b.com/b.php.suppose a.php has a form.
<form method="post" action="">
name: <input type="text" name="name" /><br />
email: <input type="text" name="email" />
</form>
the following is my code php code part in a.php. how to receieve the transversed data in b.com/b.php
$url = 'http://www.b.com/b.php';
$fields = array(
'username' => addslashes($_POST['name']),
'email' => addslashes($_POST['email']),
'ip' => $_SERVER['REMOTE_ADDR']
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
how to write the form action part? is there something wrong with my code? thank you.