Hi, I'm trying a basic thing. I have two files: curl.php and form.php
curl.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/test/test34_curl_post/form.php");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'nabc' => 'fafafa'
));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
form.php
<form action="form.php" method="post">
<input type="hidden" name="nabc" value="abc" />
<input type="submit" name="submit" value="Send" />
</form>
<?php
if(isset($_POST['submit']))
{
echo '<br />Form sent!'.$_POST['nabc'];
}
?>
what I'm hoping to get is as the result of running curl.php, to see "Form sent!". It seems as if it wasn't sent as POST. In firebug (network) there is only one GET request and what I get is the form, nothing sent. Anyone, please help.