cURL / Mailing Lists / curl-users / Single Mail

curl-users

Posting form containing a hidden field with a very long string value

From: Ferry Ie <ferry.ie_at_optusnet.com.au>
Date: Thu, 4 Jan 2007 23:11:05 +1100

Hi,

 

I am a curl newbie and am having a problem trying to post a form containing
a hidden field with a very long string value. I’ve been playing around with
this for days and am wondering if anyone can help. Kind of desperate now
:-). The following explains what I am trying to do:

 

Hitting a submit button on the test html page below produces a server HTTP
response of 302 (redirect) before the browser follows the redirect location.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body id="home" class="zeustypeHP">
<div id="zeuswrap">
        <div id="zeuscontentwrap">
                <form name="__aspnetForm" method="post"
action="http://www.domain.com.au/DomainDefault.aspx" id="__aspnetForm">
<input type="hidden" name="__VIEWSTATE"
value="dDwyNTIwMjMxMDg7dDw7bDxpPDA+Oz47bDx0PDtsPGk8MD47PjtsPHQ8O2w8aTwwPjtpP
DE+O2k8Mj47aTwzPjtpPDQ+O2k8Nz47aTw4PjtpPDk+O2k8MTA+O2k8MTE+O2k8MTI+O2k8MTM+O
2k8MTQ+O2k8MTU+O2k8MTY+O2k8MTg+Oz47bDx0PHA8bDxpbm5lcmh0bWw7PjtsPFJlYWwgRXN0Y
XRlIGZvciBTYWxlLCBSZW50IGFuZCBTaGFyZSBAIERvbWFpbi5jb20uYXU7Pj47Oz47dDxwPGw8Y
29udGVudDs+O2w8UmVhbCBlc3RhdGUgQCBEb21haW4uY29tLmF1LiBIb3VzZXMgYW5kIGFwYXJ0b
WVudHMgZm9yIHNhbGUgb3IgcmVudCBhbGwgb3ZlciBBdXN0cmFsaWEuIFRob3VzYW5kcyBvZiBwc
m9wZXJ0aWVzIGluIFN5ZG5leSwgTWVsYm91cm5lLCBCcmlzYmFuZSwgUGVydGgsIEFkZWxhaWRlL
CBIb2JhcnQgYW5kIER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+O2w8X2N0bDA6QnVzaW5lc3NRdWlja1NlYXJjaDE6ZGR
sUHJvcFR5cGVzOz4+JSmxFR64fxtxWlDB87zuXXeBHjM=" />
                        <div id="zeuscontent"><a name="zeusmaincontent"></a>

                                <div class="zeussearchTo">
                                                <h2
class="zeushSearchToBuy">Search to buy</h2>
<label id="zeuslabSearchToBuy" for="searchToBuy">Enter suburb, postcode or
property ID</label>
<input name="_ctl0:SearchMoreCriteria1:zuessearchToBuy" type="text"
maxlength="255" id="_ctl0_SearchMoreCriteria1_zuessearchToBuy" tabindex="1"
class="zeustinput" value="2121" />
<input type="submit" name="_ctl0:SearchMoreCriteria1:zeusSearch"
value="Search" id="_ctl0_SearchMoreCriteria1_zeusSearch" class="zeussubmit"
/>
                                </div>
</form>
</body>
</html>

 

As you can see from the above, a field called ‘__VIEWSTATE’ has a very long
string value. My question is: how do I emulate this using the curl command
line. I tried the following:

 

curl -F "__VIEWSTATE=@viewstate.txt;type=application/x-www-form-urlencoded"
-F "_ctl0:SearchMoreCriteria1:zuessearchToBuy=2121" -F
"_ctl0:SearchMoreCriteria1:zeusSearch=Search" -A "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" HYPERLINK
"http://www.domain.com.au/DomainDefault.aspx"http://www.domain.com.au/Domain
Default.aspx

 

But the above doesn’t seem to produce the same result (server response is
200 OK instead of 302). The viewstate.txt contains the long string value
that I copied from the above html. Removing the
type=application/x-www-form-urlencoded still produces the same result. Would
anyone know what I am missing here. Any help is greatly appreciated. Thanks

 

Regards,

Ferry

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.2/613 - Release Date: 1/01/2007
2:50 PM
-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 2/01/2007
2:58 PM
 
Received on 2007-01-04