By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

libcurl form posting problem

P: n/a
Hey all,

I've been trying to write a short script using curl w/ php but can't
figure something out:

I'm simply trying to login to a website using a posted user/pass combo
to an html form (login.php) that, if correct, sends a Header("Location:

The problem I'm running into is when I successfully login, i'm watching
the logs and it's actually executing success.php but after that's done
the screen just refreshes and stays on login.php... does this have
anything to do with the session variables that are written to tell the
system that I should be logged in?

Does this make sense? Below are my opts.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$curl_output=curl_exec ($ch);
curl_close ($ch);

echo $curl_output;
Thanks a ton,

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.