cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to POST to a page with multiple forms

From: Nick S. <basebn_at_msn.com>
Date: Fri, 09 Jun 2006 01:34:26 -0400

I'm very new to this, so forgive me if I have missed something in the
tutorial.

I cannot figure out how to correctly POST to a page with multiple forms
shown below:
<FORM ACTION="/ssb/prod/twbksrch.P_ShowResults" METHOD="POST">
<INPUT TYPE="text" NAME="KEYWRD_IN" SIZE="20" MAXLENGTH="65"
ID="keyword_in_id">
<INPUT TYPE="submit" VALUE="Go">
</FORM>
and another:
<FORM ACTION="HZSKVTSC.P_ProcRequest" METHOD="POST" CLASS=atted>
....
<SELECT NAME="CAMPUS">...
</FORM>

I would like to completely ignore the first form and fill the inputs of the
second form. This is what I have tried to do, only to receive program
output saying "MISMATCH, VARIABLES IN FORM NOT IN PROCEDURE: TERMYEAR,
SUBJ_CODE, CRSE_NUMBER..." all of which are fields of the second form that I
try to fill using curl_formadd().

My current code looks something like this:
curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "CAMPUS",
CURLFORM_COPYCONTENTS, "0", CURLFORM_END);
//...all formadd()'s
curl = curl_easy_init();
if(curl) {
        curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
        curl_easy_setopt(curl, CURLOPT_URL, "http://...")
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
}

Any help with this would be greatly appreciated.

Thanks,
Nick Sau

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Received on 2006-06-09