Re: cuRL script won't submit

From: Date: Wed, 02 Apr 2008 13:54:16 +0000
Subject: Re: cuRL script won't submit
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-272441@lists.php.net to get a copy of this message
On Wed, Apr 2, 2008 at 9:24 AM, Test User <usertest90@yahoo.com> wrote: > why will this script not submit the form - it does input data into the form - but not submit > it. below is the script and then the html form.. thanks > [snip!] > curl_setopt($ch, > CURLOPT_URL,"http://192.168.10.10/?link=answer&l=c&qid=25AA98zRa";); [snip!] > /////////////////////////////// below is the HTML form \\\\\\\\\\\\\\\\\\\\\\\\\\\ > > <form action="/question/act;_lt=Aktsgb5HMZ0vBEUSHj_3I1YdzKIX;_lv=3" > onsubmit="this.submit1.disabled=true;" method="post" > name="template_form"> [snip!] Because you're submitting it to the wrong page. What you're doing will submit to the default (index) page in that directory, as opposed to the form action. Change this: curl_setopt($ch, CURLOPT_URL,"http://192.168.10.10/?link=answer&l=c&qid=25AA98zRa";); curl_setopt ($ch, CURLOPT_POSTFIELDS, "link=answer&qid=25AA98zRa&.crumb=x88&textarea=here+ya+go&prev_ans_page=&e=0&submit1=Submit"); To this: curl_setopt($ch, CURLOPT_URL,"http://192.168.10.10/question/act;_lt=Aktsgb5HMZ0vBEUSHj_3I1YdzKIX;_lv=3"); curl_setopt ($ch, CURLOPT_POSTFIELDS, "link=answer&qid=25AA98zRa&.crumb=x88&textarea=here+ya+go&prev_ans_page=&e=0&submit1=Submit"); Also, note two things: 1.) I removed the semicolon from the end of the CURLOPT_URL value (between the quotes and parentheses). 2.) The form action looks like it's most likely dynamic, so you'll have to think of a workaround yourself if it is. -- </Daniel P. Brown> Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283

« previous php.general (#272441) next »