The code below outputs the input stream
[code=php]<?php
$input = file_get_contents(“php://input”);
echo $input;
?>
<form method=”post” action=”test.php”>
<input type=”text” name=”test1″ value=””>
<input type=”text” name=”test2″ value=””>
<input type=”text” name=”test3″ value=””>
<input type=”submit” name=”submit” value=”Add”>
</form>
But when I use curl to post to the same script there is no input stream.
[code=php]$post_str = array(‘cmd’ => ‘check_user’);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “test.php”);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
?>
Anybody know why?
Thanks!