curl-users
Re: Can't press a non-submit button
Date: Fri, 07 Sep 2007 09:27:26 +0200
Will Weatherford wrote:
> I can select an option from a pull down list:
> curl [...] https://157.184.14.68/[...]
I couldn't connect to the Lexmark host you mention, thus could make no use
of the command line you supplied. However, it looks correct.
>
> But I am unable to go to another web page, below, make some selections
> and press the "Add" "Modify" or "Delete" button. Here are my efforts:
> curl [...] -d 0.type=1 [...] -d 101.system.configurationScheduler=Add
Those name=value options look correct.
>
> curl [...] -d 0.days=2&press=Add [...]
"press" is not the name of an input field below.
(And there's no reason to mix `&'s and repeated -d)
>
> <TR><TD>Action</TD><TD>
> <SELECT NAME="0.type">
> <OPTION SELECTED VALUE="-1">----</OPTION>
> <OPTION VALUE="0">Print faxes</OPTION>
> <OPTION VALUE="1">Hold faxes</OPTION>
Thus, -d 0.type=1 selects the latter.
> </SELECT>
> </TD></TR>
> <TR><TD><INPUT TYPE="HIDDEN" NAME="1.id" SIZE=22
> MAXLENGTH=16 VALUE=""></TD></TR>
Browsers don't display hidden fields (thus usually they don't have
sizes) but they do send those name=value pair to the remote host
(e.g. to keep state info when the form changes, similar to cookies.)
> <TD><input TYPE="submit" NAME="101.system.configurationScheduler"
> VALUE="Add"> </TD>
Thus, -d 101.system.configurationScheduler=Add performs the latter.
> [...]
> </FORM>
Where was the <Form> start tag? Look carefully at its action=URL
attribute: it is the location where the browser sends the data.
Often it is the same as the url that prepares the empty form,
but sometimes there are static html pages containing empty forms
that send them to a different url (e.g. in order to save server's
cpu.)
Also, you should watch for OnSubmit and OnClick attributes, in case
javascript functions alter the data before it is sent, or send it
directly to the remote host bypassing the browser's built-in submit
(e.g. so that the browser stays on the same page while dynamically
changing some parts of it.)
Good luck
Ale
Received on 2007-09-07