我必须传递一个数据数组到服务器,也得到服务器的响应..我得到未定义的变量在clientside.php上的错误我在哪里试图print_r接收..我如何得到响应在服务器端并发送回附加信息客户端..我现在用卷曲的函数来实现这个..如何获得附加到curl函数的数据在服务器端?
我clientside.php
$url = "http://some_ip_address/../../../../serverside.php";
//$abc is variable which contains all data in array format
$abc;
$post_data = array('data' => serialize($abc));
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if(curl_exec($ch) === false) {
echo 0;
} else {
echo 1;
}
$output= curl_exec($ch);
echo $output;
curl_close ($ch);
我Serverside.php是这样
print_r($_POST['data']);
我是gett荷兰国际集团下面的错误
*Notice: Undefined index: data*
尝试'print_r($ _ REQUEST);'并检查输出是什么? – 2013-04-10 07:48:00
使用类似于萤火虫的东西来查看curl请求,看看它是否实际上以POST的形式发送这些值,甚至根本没有。 – Danny 2013-04-10 07:50:35
错误消失了,但我没有得到数据..只有空阵列是我越来越... – 2013-04-10 07:52:31