$_POST is always empty
Posted: Sun Oct 31, 2010 8:10 am
Can someone run the following script on their own server and test?
test.php
postdump.php
I am always getting $_POST as empty.
test.php
Code: Select all
<?php
$url = "http://localhost/postdump.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_HTTPHEADER, array('"Content-type: text/plain; charset=UTF-8"'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "Hello");
$result = curl_exec($ch);
?>Code: Select all
<?php
echo "Inside post dump--";
//print_r($_SERVER);
//$data = file_get_contents('php://input');
//print_r($data);
print_r(count($_POST));
print_r($_POST);
//print_r(count($_REQUEST));
//print_r($_REQUEST);
?>