This is a discussion on Re: [PHP] cuRL script won't submit within the PHP General forums, part of the PHP Programming Forums category; many thanks.. I have been working on this for weeks! now I have to figure out how to extract that ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
many thanks.. I have been working on this for weeks!
now I have to figure out how to extract that dynamic URL from the form before I post.. ----- Original Message ---- From: Daniel Brown <parasane@gmail.com> To: Test User <usertest90@yahoo.com> Cc: php-general@lists.php.net Sent: Wednesday, April 2, 2008 8:54:16 AM Subject: Re: [php] cuRL script won't submit 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=her e+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=her e+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 __________________________________________________ __________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com |
|
|||
|
On Wed, Apr 2, 2008 at 10:23 AM, Test User <usertest90@yahoo.com> wrote:
> many thanks.. I have been working on this for weeks! > now I have to figure out how to extract that dynamic URL from the form before I post.. This may help to start: <?php $data = file_get_contents('http://www.website.com/html_form.html'); preg_match('/form action="(.*)"/Uis',$data,$matches); print_r($matches); ?> -- </Daniel P. Brown> Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Just ask! |