Bluehost.com Web Hosting $6.95

Re: [PHP] cuRL script won't submit

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-02-2008
Test User
 
Posts: n/a
Default 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 <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

Reply With Quote
  #2 (permalink)  
Old 04-02-2008
Daniel Brown
 
Posts: n/a
Default Re: [PHP] cuRL script won't submit

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!
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:24 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0