cURL Help - Posting a Form
| From: | Nick Wilson | Date: | Sat, 11 Sep 2004 09:36:29 +0000 |
| Subject: | cURL Help - Posting a Form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196390@lists.php.net to get a copy of this message | ||
hi all,
Im trying to get the following php code to output the
'success'/'failure' page from posting a form to a site. The problem is
that there is no output at all, so i must be doing somthing silly, but
cant work out what! ;-)
## Code
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://example.com/form.html");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_REFERER, "http://nowhere.com");
curl_setopt($ch, CURLOPT_USERAGENT, "CommentMaker 0.8");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"static=$static&entry_id=$entry_id&author=" . urlencode($author) .
"&email=" . urlencode($email)
."&url=$myurl&bakecookie=Forget+Info&text=" . urlencode($text) .
"&post=+Post+");
$result=curl_exec($ch);
curl_close($ch);
print($result);
## End Code
Anyone see the problem/mistake?
Much thx...
--
Nick W