cURL / Mailing Lists / curl-users / Single Mail

curl-users

HTML Form POST thru JavaScript OnClick problem

From: Charles Wallace <Charles.Wallace_at_rfidtecllc.com>
Date: Fri, 13 Jul 2012 13:37:08 -0700

I'm trying to POST thru curl, to a web form which also uses javascript.
I can not figure out the proper syntax, and am looking for help.
This is an embedded chipset, and uses HTTP 1.0

The webpage resides at http://10.0.12.2/generic.htm

I want to issue the Generic command "06984631", which works fine from the
web page itself.

I have tried several variations to my curl command, such as:

curl -0 --trace-ascii debugdump.txt --data "generictext=06984131"
http://10.0.12.2/generic.htm

I tried going thru the "generictext" field, but does not work.
Is this possible with curl ?
Any help would be greatly appreciated.

debugdump.txt is as follows:

== Info: About to connect() to 10.0.12.2 port 80 (#0)
== Info: Trying 10.0.12.2...
== Info: connected
== Info: Connected to 10.0.12.2 (10.0.12.2) port 80 (#0)
=> Send header, 154 bytes (0x9a)
0000: POST /generic.htm HTTP/1.0
001c: User-Agent: curl/7.26.0
0035: Host: 10.0.12.2
0046: Accept: */*
0053: Content-Length: 20
0067: Content-Type: application/x-www-form-urlencoded
0098:
=> Send data, 20 bytes (0x14)
0000: generictext=06984131
== Info: upload completely sent off: 20 out of 20 bytes
== Info: HTTP 1.0, assume close after body
<= Recv header, 24 bytes (0x18)
0000: HTTP/1.0 404 Not found
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 11 bytes (0xb)
0000: Not found
== Info: Closing connection #0

-----------------------------------------------------------
The webpage source is as follows:

<html><head><meta http-equiv="Content-Type" content="text/html;
charset=big5"><title>Generic Command</title></head><script
language="JavaScript" src="getxmlobj1.js"></script><script
language="javascript" src="utilities.js"></script><script
language="javascript"> function ValueDisplay(ResValue)
{ var displayvalue;
displayvalue=ResValue.XMLDevice.responseText;
if (ResValue.Text=="genericid") {
document.generic.genericid.value=displayvalue; }
else alert("Please Reflesh!!");
} function SendGenericCmd() {
GetServerFile("1?3="+document.generic.genericid.value,"");
GetServerFile("retcmd.cgi","genericid");
}</script><body><form name="generic"><tr> <td>Button Command:</td>
<td> <input type="text" name="3" id="LCDText" size="16"></input>
</td> <td> <input type="button" value="Send"
onclick="GetServerFile('1?3='+document.getElementById('LCDText').value,'')">
</input> </td> <br><br> <td>Generic Command:</td> <td>
<input type="text" name="generictext" id="genericid" size="32"></input>
</td> <input type="button" value="Send"
onclick="SendGenericCmd();"></input> </tr> <p>
<input type="button" value="Menu" onclick="GetServerFile('1?3=01F7','')">
<input type="button" value="Down" onclick="GetServerFile('1?3=01FA','')">
<input type="button" value="UP" onclick="GetServerFile('1?3=01FB','')">
<input type="button" value="Left / -"
onclick="GetServerFile('1?3=01FD','')"> <input type="button"
value="Right / +" onclick="GetServerFile('1?3=01FC','')">
</p></form></body></html>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-13