I'm trying to run a simple PHP form filler; here is the code:
$post = "username=myusername&password=mypassword";
$ch = curl_init("[
www.thesite.com]
;
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
echo $out;
All I'm getting is the /privatelogin page back, as if the POSTFIELDS command ain't working. I cribbed the above example directly from Practical PHP Programming. cURL is enabled properly by editing php.ini under Apache2. For example, here is another trivial snippet which does work:
$ch = curl_init("[
www.google.com]
;
$fp = fopen("example_homepage.txt", "w"
;
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
So I'm thinking that my problem lies in the CURLOPT commands, and that CURL_POSTFIELDS is the culprit. I'm running 1.7.2 under XP Pro.
Should I report this to the cURL people?