我想發送數據到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