[PHP] cuRL script won't submit
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 #!/usr/bin/php ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, /temp/cookie.txt); curl_setopt($ch, CURLOPT_URL,http://192.168.10.10/?link=answerl=cqid=25AA98zRa;;); curl_setopt ($ch, CURLOPT_POSTFIELDS, link=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0sumbit1=Sumbit); $result = curl_exec ($ch); curl_close ($ch); echo $result; ? /// below is the HTML form \\\ form action=/question/act;_lt=Aktsgb5HMZ0vBEUSHj_3I1YdzKIX;_lv=3 onsubmit=this.submit1.disabled=true; method=post name=template_form input type=hidden value=answer name=link/ input type=hidden value=25AA98zRa name=qid/ input type=hidden value=x88 name=.crumb/ input type=hidden value= name=textarea/ input type=hidden value= name=refer/ input type=hidden value= name=prev_ans_page/ input type=hidden value=0 name=e/ input class=button type=submit name=submit1 value=Submit/ /form 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cuRL script won't submit
I added more info below and corrected the spelling of a word - very sorry to add more to your already full mailbox 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 #!/usr/bin/php ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, /temp/cookie.txt); curl_setopt($ch, CURLOPT_URL,http://192.168.10.10/?link=answerl=cqid=25AA98zRa;;); curl_setopt ($ch, CURLOPT_POSTFIELDS, link=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0submit1=Submit); $result = curl_exec ($ch); curl_close ($ch); echo $result; ? /// below is the HTML form \\\ form action=/question/act;_lt=Aktsgb5HMZ0vBEUSHj_3I1YdzKIX;_lv=3 onsubmit=this.submit1.disabled=true; method=post name=template_form input type=hidden value=answer name=link/ input type=hidden value=25AA98zRa name=qid/ input type=hidden value=x88 name=.crumb/ input type=hidden value= name=textarea/ input type=hidden value= name=refer/ input type=hidden value= name=prev_ans_page/ input type=hidden value=0 name=e/ input class=button type=submit name=submit1 value=Submit/ /form 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 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
Re: [PHP] cuRL script won't submit
On Wed, Apr 2, 2008 at 9:24 AM, Test User [EMAIL PROTECTED] 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=answerl=cqid=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=answerl=cqid=25AA98zRa;;); curl_setopt ($ch, CURLOPT_POSTFIELDS, link=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0submit1=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=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0submit1=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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cuRL script won't submit
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 [EMAIL PROTECTED] To: Test User [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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=answerl=cqid=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=answerl=cqid=25AA98zRa;;); curl_setopt ($ch, CURLOPT_POSTFIELDS, link=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0submit1=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=answerqid=25AA98zRa.crumb=x88textarea=here+ya+goprev_ans_page=e=0submit1=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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cuRL script won't submit
On Wed, Apr 2, 2008 at 10:23 AM, Test User [EMAIL PROTECTED] 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! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php