我想发送数据到url并转到url ...我使用index.php
进行登录并将发送数据发送到enter.php
但我不知道如何在enter.php中使用post数据? 我使用cURL
。如何发送发布数据到一个URL并转到URL与PHP?
的index.php:
<?
$c = curl_init();
curl_setopt($c , CURLOPT_URL , 'http://localhost/enter.php');
curl_setopt($c , CURLOPT_POST , 1);
curl_setopt($c , CURLOPT_POSTFIELDS , 'name=Elmi&surname=Ehmedov');
curl_exec($c); curl_close($c);
?>
enter.php:
<?
$nm = $_POST['name'];
$snm = $_POST['surname'];
echo $nm , $snm;
?>
谢谢你的建议。
什么问题? – Robik 2011-06-15 11:21:47
不要去'enter.php'打开'index.php'里面的'enter.php'。 – 2011-06-15 11:23:40
你的代码工作正常..你需要接下来发生什么? – 2011-06-15 11:26:25