curl-users
Re: checkchoice java routine
Date: Sun, 22 Apr 2001 19:36:16 +0200 (MET DST)
On Sat, 21 Apr 2001, Peter Berghmans wrote:
> I'm a CCNA trainer. Doing so I have to activate exams for my students on
> http://cisco.netacad.net/cnacs/prot-doc/activate_exams.shtml?CLASS_ID=112897,
> a password protected page. The page source is in attachement.
>
> Problem is: i have to reactivate each exam after 8 hours. So I want to do
> some kind of automatisation using curl.
So you have to post that form with curl?
> So I the command was:
> curl -d
> "name=EXAM_0_ACT&onclick=checkChoice(document.activateexam.EXAM_0_ACT,1)
> &type=radio%20checked&value=1" http://cisco.netacad.net/cnacs/prot-
> doc/activate_exams.shtml?CLASS_ID=112897
A HTML form is plain data. You can't do any "onclick" stuff when submitting a
form, that is javascript magic that the browser performs independent of
forms.
I passed your HTML page to the 'formfind.pl' script and it produced a rather
large output that in describes the fields that you can fill-in in that form.
For info, I'll show you some of what it produced:
--- FORM report. Uses POST to URL "activate_exams.shtml"
Input: CLASS_ID=112897 (HIDDEN)
Input: FCOUNT=0 (HIDDEN)
Input: ACOUNT=0 (HIDDEN)
Input: EXAM_0_ACT=11510_0_4_112897_ (CHECKBOX)
Input: EXAM_0_ACT=1 (RADIO)
Input: EXAM_0_ACT=2 (RADIO)
Input: EXAM_0_ACT=8 (RADIO)
Input: EXAM_1_ACT=11511_0_4_112897_ (CHECKBOX)
Input: EXAM_1_ACT=1 (RADIO)
Input: EXAM_1_ACT=2 (RADIO)
Input: EXAM_1_ACT=8 (RADIO)
... [cut]
Input: EXAM_14_ACT=261_0_16_112897_ (CHECKBOX)
Input: EXAM_14_ACT=1 (RADIO)
Input: EXAM_14_ACT=2 (RADIO)
Input: EXAM_14_ACT=8 (RADIO)
Input: Submit=Submit (SUBMIT)
--- end of FORM
So, when you want to POST to the form at activate_exams.shtml, you must fill
in the appropriate fields.
Clearly, your command line above fails to fill in a number of these fields.
I would for example, assume that the hidden fields are required by the
receiving script, why I would at least set these:
"CLASS_ID=112897&FCOUNT=0&ACOUNT=0"
The HTML reply also indicates that it wants the FCOUNT and ACOUNT fields set.
... you should also probably fill in a few other fields, like set an exam
field and the accopanying radio-button.
> Is there a solution?
I can't see why this can't done.
-- Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/Received on 2001-04-22