runeveryday — 2012-09-12T21:50:12-04:00 — #1
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" />
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();
$result = curl_exec($ch);
how to write the form action part? is there something wrong with my code? thank you.
starlion — 2012-09-13T08:28:38-04:00 — #2
a.php's form indicates that it will be sending the data to a.php, not b.php.
Action="" is translated by browsers as "Send this to myself."
If you're using a.php to curl the postvalues to b.php, then b.php should be constructed as if it were the normal receiver (get fields out of $_POST, etc).
cups — 2012-09-13T16:35:18-04:00 — #3
Are a.com and b.com on the same machine?
jgetner — 2012-09-13T16:44:35-04:00 — #4
serialize your $fields array.