Re: cuRL script won't submit
| From: | Test User | Date: | Wed, 02 Apr 2008 14:23:50 +0000 |
| Subject: | Re: cuRL script won't submit | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272444@lists.php.net to get a copy of this message | ||
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=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
____________________________________________________________________________________
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