Log in

View Full Version : Curls posting to a Punbb Register Forum



stephenalistoun
01-03-2009, 11:38 AM
Hi all,

I'm trying to post my values from my login form to the punbb form using curls.

How would I trick the punbb forum in the time taken?

I get the following message how would I prevent this problem?

"Unable to confirm security token. A likely cause for this is that some time passed between when you first entered the page and when you submitted a form or clicked a link. If that is the case and you would like to continue with your action, please click the Confirm button. Otherwise, you should click the Cancel button to return to where you were."



$Curl_Session = curl_init('http://www.punbb.co.za/Forums/register.php');

curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session,
CURLOPT_POSTFIELDS, "req_username=Gascan&req_email1=steve@gmail.com&req_password1=gascan&req_password2=gascan");

curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_exec ($Curl_Session);
curl_close ($Curl_Session);

Thanks Stephen

jackbenimble4
01-04-2009, 04:45 AM
I'm not familiar with PunBB or it's security mechanisms, but you more than likely all you need to do is load the page with the form, and make sure you're accepting any cookies. That can be done through the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE options.

So if the register.php is the same location as the form actual users would fill out to register, you would want to load that first without sending any registration information, and then again with the registration information.

This way the system will log your request, set a session; then when you load again with the post data and the cookies w/ the session data, the script will accept your data.