Posting a textarea form with cURL

Posted by Joey on Stack Overflow See other posts from Stack Overflow or by Joey
Published on 2010-03-17T02:31:31Z Indexed on 2010/03/17 2:41 UTC
Read the original article Hit count: 464

Filed under:
|
|
|
|

How would I go about posting a textarea form?

<form method="post" action="/user/test/shoutbox/add" id="shoutPost" class="clearit">
<input name="formtoken" type="hidden" value="852f8fde54190fa5f9aa47172d492f829c1b"/>
<input type="hidden" name="backto" value="/user/text/shoutbox" />
<textarea id="shoutmsg" name="message"></textarea>
<input type="submit" name="submit" class="confirmButton" value="Post" id="sbPost"  />

This should work right?

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
$postfields .= "&message=".$msg;
$postfields .= "&submit=sbPost";
curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);

but it's not posting for some reason...

© Stack Overflow or respective owner

Related posts about curl

Related posts about php