Jump to content

Recommended Posts

Hi gurus

I have a tiny problem that i can not submit web form after receive confirmation page.

Let make myself more clear.

 

I have couple of web sites and i want to post data automatically. I wrote some php script which using  cURL. The problem is my sites has confirmation page. So far, i can post data, get confirmation page but i dont know how to post confirmation page.

All i can done with my php skill is below. Hopefully you guys help me or at least drive me to a solution with your comments.

 

Regards

 

                $ch	= curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://mysite.net/test/bbs.cgi?guid=ON");
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_REFERER, "../english/index.html");
	curl_setopt($ch, CURLOPT_POSTFIELDS, "subject=$_POST[subject]&FROM=$_POST[FROM]&mail=$_POST[mail]&MESSAGE=$_POST[MESSAGE]&bbs=english&time=1373480270&tepo=don&submit=Confirm");
	$result = curl_exec ($ch);
	curl_close($ch);
	echo $result;

Link to comment
https://forums.phpfreaks.com/topic/201334-confirmation-post-with-curl/
Share on other sites

Dear teamatomic thank you very much for your reply.

Let me explain step by step;

1 - my previous code auto submit form

2 - return result shows me confirmation page to make sure i have entered correct data through my browser (echo $result)

3 - There is another submit button (i entered correct value, please send it)

4 - here is my code stop...

5 - i want to submit that form too. but seems i can not with my code.

 

please give me an idea if have any better solution.

 

Regards

Break that page apart and see where the action goes and if it uses some kind of token for confirmation then try sending the data to that instead of the first page, if that does not work then have a second piece of curl code to submit whatever you parse out of $result.

 

 

HTH

Teamatomic

  • 4 years later...

I don't understand you, but a couple of pointers...

 

1. curl can return the error, if any for the current request. check it if it helps: http://php.net/manual/en/function.curl-error.php . Similarly there is curl_info
2. The values being passed to POSTFIELDS should be urlencode'ed
3. Referer doesn't seem right

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.