<?php
$data = array('name' => 'Ross', 'php_master' => true);
$url="http://localhost/test.php";
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_exec($handle);
?>
The $_POST variable on the server side is empty. I also tried using Java servlet; request.getParameterNames() is also empty. Why are the post parameters lost?
you need to convert your $data array to a url-encoded string of key/value pairs: