cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Can't press a non-submit button

From: Will Weatherford <fiveweatherfords_at_gmail.com>
Date: Fri, 7 Sep 2007 13:39:17 -0400

Your response was very helpful. This device is the a printer with an
adapter web page. The View Source for the page I am trying to manipulate
is:

<HTML><HEAD><META HTTP-EQUIV="Content-type" CONTENT="text/html;
charset=UTF-8">
<TITLE>Fax Shortcut Setup</TITLE>
<LINK REL="stylesheet" HREF="/configStyle.css" TYPE="text/css">
</HEAD>
<BODY>
<H1>Configuration</H1>
<FORM
ACTION="/cgi-bin/posttest/cgi-bin/dynamic/config/shortcuts/faxholdsched.html"
METHOD="post">
<H2>Fax Holding Schedule</H2><TABLE>
<INPUT TYPE="hidden" NAME="100.system.configurationScheduler" VALUE=0>

<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>
</SELECT>
</TD></TR>
<TR><TD>Time</TD><TD>
<SELECT NAME="0.hour">
<OPTION SELECTED VALUE="-1">----</OPTION>
<OPTION VALUE="0">0000</OPTION>
<OPTION VALUE="1">0100</OPTION>
<OPTION VALUE="2">0200</OPTION>
<OPTION VALUE="3">0300</OPTION>
<OPTION VALUE="4">0400</OPTION>
<OPTION VALUE="5">0500</OPTION>
<OPTION VALUE="6">0600</OPTION>
<OPTION VALUE="7">0700</OPTION>
<OPTION VALUE="8">0800</OPTION>
<OPTION VALUE="9">0900</OPTION>
<OPTION VALUE="10">1000</OPTION>
<OPTION VALUE="11">1100</OPTION>
<OPTION VALUE="12">1200</OPTION>
<OPTION VALUE="13">1300</OPTION>
<OPTION VALUE="14">1400</OPTION>
<OPTION VALUE="15">1500</OPTION>
<OPTION VALUE="16">1600</OPTION>
<OPTION VALUE="17">1700</OPTION>
<OPTION VALUE="18">1800</OPTION>
<OPTION VALUE="19">1900</OPTION>
<OPTION VALUE="20">2000</OPTION>
<OPTION VALUE="21">2100</OPTION>
<OPTION VALUE="22">2200</OPTION>
<OPTION VALUE="23">2300</OPTION>
</SELECT>
</TD></TR>
<TR><TD>Day(s)</TD><TD>
<SELECT NAME="0.days">
<OPTION SELECTED VALUE="-1">----</OPTION>
<OPTION VALUE="0">Sunday</OPTION>
<OPTION VALUE="1">Monday</OPTION>
<OPTION VALUE="2">Tuesday</OPTION>
<OPTION VALUE="3">Wednesday</OPTION>
<OPTION VALUE="4">Thursday</OPTION>
<OPTION VALUE="5">Friday</OPTION>
<OPTION VALUE="6">Saturday</OPTION>
<OPTION VALUE="7">Everyday</OPTION>
<OPTION VALUE="8">Weekdays</OPTION>
<OPTION VALUE="9">Weekends</OPTION>
</SELECT>
</TD></TR>

<TR><TD><INPUT TYPE="HIDDEN" NAME="1.id" SIZE=22 MAXLENGTH=16
VALUE=""></TD></TR>
<TR><TD><INPUT TYPE="HIDDEN" NAME="0.minute" SIZE=4 MAXLENGTH=4
VALUE="0"></TD></TR>
</TABLE><HR SIZE=2 ALIGN=LEFT WIDTH="75%" NOSHADE><TABLE>
<TR>
<TD><input TYPE="submit" NAME="101.system.configurationScheduler"
VALUE="Add">&nbsp;&nbsp;</TD>
<TD><input TYPE="submit" NAME="102.system.configurationScheduler"
VALUE="Modify">&nbsp;&nbsp;</TD>
<TD><input TYPE="submit" NAME="103.system.configurationScheduler"
VALUE="Delete Entry">&nbsp;&nbsp;</TD>
<TD><input TYPE="submit" NAME="104.system.configurationScheduler"
VALUE="Delete List"></TD>
<TD><input TYPE="button" VALUE="Empty Form" onClick="theRandom=Math.random
();window.open('/cgi-bin/dynamic/config/shortcuts/faxholdsched.html?rand='+theRandom,'_self')"></TD>
</TR>
</FORM>
</TABLE>

<TABLE BORDER="1" WIDTH="500">
<TR><TD width=15%>Action</TD><TD width=15%>Time</TD><TD
width=15%>Day(s)</TD></TR>
<TR><TD><a HREF="
/cgi-bin/dynamic/config/shortcuts/faxholdsched.html?index=8%3A17%3A0%3A1">Hold
faxes</a></TD><TD>1700</TD><TD>Weekdays</TD></TR>
<TR><TD><a HREF="
/cgi-bin/dynamic/config/shortcuts/faxholdsched.html?index=8%3A9%3A0%3A0">Print
faxes</a></TD><TD>0900</TD><TD>Weekdays</TD></TR>

</TABLE>
</BODY></HTML>

Following instructions in your note I ran this cURL command: and got the
response below:

curl --insecure -v -A "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;.NET
CLR 2.0.50727; InfoPath.1; .NET CLR 1.1.4322)" -u MarkNet:administrator -e
https://157.184.14.68/cgi-bin/dynamic/config/gen/fax/holdingfax.html -d
0.type=1 -d 0.hour=13 -d 0.days=2 -d 101.system.configurationScheduler=Add
https://157.184.14.68/cgi-bin/dynamic/config/shortcuts/faxholdsched.html >>
"C:\Documents and Settings\weather\Desktop\results.log"

ttings cURL 9_07\Dev>curl --insecure -v -A "Mozilla/4.0 (compatible; MSIE
7.0; W
indows NT 5.1;.NET CLR 2.0.50727; InfoPath.1; .NET CLR 1.1.4322)" -u
MarkNet:adm
inistrator -e
https://157.184.14.68/cgi-bin/dynamic/config/gen/fax/holdingfax.ht
ml -d 0.type=1 -d 0.hour=13 -d 0.days=2 -d
101.system.configurationScheduler=Add
 https://157.184.14.68/cgi-bin/dynamic/config/shortcuts/faxholdsched.html >>
"C:
\Documents and Settings\weather\Desktop\results.log"
* About to connect() to 157.184.14.68 port 443
* Trying 157.184.14.68... connected
* Connected to 157.184.14.68 (157.184.14.68) port 443
* SSLv2, Client hello (1):
SSLv3, TLS handshake, Server hello (2):
SSLv3, TLS handshake, CERT (11):
SSLv3, TLS handshake, Server finished (14):
SSLv3, TLS handshake, Client key exchange (16):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSL connection using AES256-SHA
* Server certificate:
* subject: /O=Lexmark
Int./OU=PS&SD/L=Lexington/ST=Kentucky/C=US/CN=ET000
400F3AF2C.
* start date: 2007-05-15 16:01:00 GMT
* expire date: 2010-05-14 16:01:00 GMT
* common name: ET000400F3AF2C. (does not match '157.184.14.68')
* issuer: /O=Lexmark
Int./OU=PS&SD/L=Lexington/ST=Kentucky/C=US/CN=ET0004
00F3AF2C.
* SSL certificate verify result: error number 1 (18), continuing anyway.
* Server auth using Basic with user 'MarkNet'
> POST /cgi-bin/dynamic/config/shortcuts/faxholdsched.html HTTP/1.1
> Authorization: Basic TWFya05ldDphZG1pbmlzdHJhdG9y
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;.NET CLR
2.0.507
27; InfoPath.1; .NET CLR 1.1.4322)
> Host: 157.184.14.68
> Accept: */*
> Referer:
https://157.184.14.68/cgi-bin/dynamic/config/gen/fax/holdingfax.html
> Content-Length: 65
> Content-Type: application/x-www-form-urlencoded
>
> 0.type=1&0.hour=13&0.days=2&101.system.configurationScheduler=AddHTTP/1.0200
OK
  % Total % Received % Xferd Average Speed Time Time Time
Current
                                 Dload Upload Total Spent Left
Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0<
Expires: Sun, 27 Feb 1972 08:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache
< Content-Type: text/html
100 3273 0 3273 0 0 5994 0 --:--:-- --:--:-- --:--:--
639k*
Closing connection #0
* SSLv3, TLS alert, Client hello (1):

This looks like progress, but it did not add an additional entry to the
page, as I want to do.

Additional comments would be greatly appreciated.

On 9/7/07, Alessandro Vesely <vesely_at_tana.it> wrote:
>
> 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">&nbsp;&nbsp;</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