现在我想将 POST 数据横向输入a.com/a.php
到b.com/b.php
.supposea.php
有一个表单。
<form method="post" action="">
name: <input type="text" name="name" /><br />
email: <input type="text" name="email" />
</form>
以下是我的代码 php 代码部分a.php
。如何接收横向数据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);
curl_close($ch);
如何编写表单动作部分?我的代码有问题吗?谢谢你。