Can't submit a form.

hello
my script is submitting POST-data to a site
(its not my first script, i've done these before many times (include parsing scripts) but this one is tough)

so the problem is i'm submitting a form with firefox
and in firebug i see WHAT exactly i'm submitting
then
when i do EXACTLY the same with my script
it's simply not working
so i have the question to pro's:
WHYYYYYYYYYYYY :confused:

there is one thing.. the data have about 20 parameters and some of them:

__EVENTARGUMENT
__EVENTTARGET
__EVENTVALIDATION
__LASTFOCUS
__VIEWSTATE
>datahere<

can change their position in the block of post-data
they can be like:

__LASTFOCUS
>datahere<
__EVENTARGUMENT
__EVENTTARGET
__EVENTVALIDATION
__VIEWSTATE

or:

__LASTFOCUS
__EVENTARGUMENT
__EVENTTARGET
__VIEWSTATE
>datahere<
__EVENTVALIDATION

or somewhere else

and i think maybe javascript doing this somehow but dunno if this can be a problem
the whole site looks like writting by a monkey. rly. have bugs in JS and in HTML also.
there's also the key which is changing when loading this page but i'm catching it

PS plx don't put this topic to "web-programming" last answer there was a week ago :eek:

What error r u gtting. Can u paste ur code?

no errors
it's just reloading the same page
my code:

$socket=IO::Socket::INET->new("$host:80");
defined $socket or die "!!! 029 $!\n";
        
print $socket "POST /script.aspx HTTP/1.1
Host: $host
User-Agent: $ua
Connection: keep-alive
Referer: http://$host/script.aspx
Cookie: $cookie
Content-Type: application/x-www-form-urlencoded
Content-Length: ".(length$content)."
        
$content";

same problem with LWP btw
it's perl

If you cannot post your code, we cannot help you.

[edit] edit it in under me, why don't you. :wink:

From simple rules of the UNIX.COM forums:

Regards,
Alister

What is $host ? What is $content?

I'm not sure this looks right:

length$content
length $content

you can't try it by yourself there's authorization
length$content works fine for all times
there's no mistakes in code, i've done it many times
my question was - why there some options changing places in data?
and why it working fine in browser and not working in script?

btw this __EVENTDATA some shit from ASP.net
some protection mechanism maybe

Workin' too hard, length is optional.

Post data doesn't need to be in specific order. They can vary and there's no problem because of that. In ASP.NET apart from post data whole html response of the page goes. Apart from that evendata,viewstate,cookies content etc. They all need not to be in order. So tell us what exactly is the difference between posting through firefox mozilla and through script

there's NO difference
that's the problem

Use truss/tusc/strace and look.

lolwut?

Not sure yet. What is your problem and what are you trying to do

googled
compared every single symbol in FF and my script
googled
did rewrite it with LWP
googled
made few topics on few forums about alternative ways (like autofill the form with something like greasemonkey. the problem is that the data in mysql)
googled googled googled
analized analized analized
right now i'm reading about __eventvalidation

---------- Post updated at 02:38 ---------- Previous update was at 02:35 ----------

well the $content is this (without \n ofc):

ctl00_RadScriptManager1_TSM=%3B%3BSystem.Web.Extensions%2C+Version%3D3.5.0.0%2C+Culture%3Dneutral%2C+PublicKeyToken%3D31bf3856ad364e35%3Aen-US%3A3de828f0-5e0d-4c7d-a36b-56a9773c0def%3Aea597d4b%3Ab25378d2%3BTelerik.Web.UI%2C+Version%3D2011.3.1305.35%2C+Culture%3Dneutral%2C+PublicKeyToken%3D121fae78165ba3d4%3Aen-US%3Ac331b262-facd-47ae-9de3-709a764247d7%3A16e4e7cd%3Af7645509%3A8674cba1%3A7c926187%3Ab7778d6c%3Ac08e9f8a%3A59462f1%3Aa51ee93e%3A24ee1bba%3Af46195d3%3A5f39f986%3A1e771326%3Aaa288e2d%3B
&__EVENTTARGET=
&__EVENTARGUMENT=
&__LASTFOCUS=
&__VIEWSTATE=
&__EVENTVALIDATION=%2FwEWDwL%2BraDpAgK69%2BiwCQLp4Z%2FsDAL3m4b7DgK%2FifCuBwLzpdLbBgLX7ZikCgK5veC2DAKU8vjrCAL63sHIAQKczcH%2BBgLesLmqCALltPK2AQLltKq1AQKeuq%2BWCg%2FU8CYdpcNYOOUMmRM%2FNWMf1Oxo
&ctl00%24cphContent%24txtInputStep=0
&ctl00%24cphContent%24txtPasswd=255631371
&ctl00%24cphContent%24chkWithoutEmail=on
&ctl00%24cphContent%24txtFirstName=%D0%B1%D0%B5%D1%8E%D1%82%D1%82%D1%84%D0%B2%D1%8D%D1%84%D0%BC%D0%B2%D0%B7%D0%B8%D0%B0+%D1%8D%D0%B3%D1%8E%D0%BA%D0%BE%D1%85%D1%8E%D0%B0%D0%B7%D0%B8%D1%81%D1%81%D1%87%D1%85%D1%87
&ctl00%24cphContent%24txtLastName=%D0%B8%D1%8E%D1%89%D1%83%D1%89%D0%BD%D0%B6%D0%B3%D0%B8%D1%82%D0%B7%D0%B4%D0%B8%D1%82%D0%B1%D0%B2
&ctl00%24cphContent%24txtUniqueId=8372923875
&ctl00%24cphContent%24dtpBirthDate=1980-02-06
&ctl00_cphContent_dtpBirthDate_dateInput_text=06.02.1980
&ctl00%24cphContent%24dtpBirthDate%24dateInput=1980-02-06-00-00-00
&ctl00_cphContent_dtpBirthDate_dateInput_ClientState=%7B%22enabled%22%3Atrue%2C%22emptyMessage%22%3A%22%22%2C%22minDateStr%22%3A%221%2F1%2F1900+0%3A0%3A0%22%2C%22maxDateStr%22%3A%222%2F12%2F1999+0%3A0%3A0%22%7D
&ctl00_cphContent_dtpBirthDate_calendar_SD=%5B%5B1980%2C2%2C6%5D%5D
&ctl00_cphContent_dtpBirthDate_calendar_AD=%5B%5B1900%2C1%2C1%5D%2C%5B1999%2C2%2C12%5D%2C%5B1980%2C2%2C1%5D%5D
&ctl00_cphContent_dtpBirthDate_ClientState=%7B%22minDateStr%22%3A%221%2F1%2F1900+0%3A0%3A0%22%2C%22maxDateStr%22%3A%222%2F12%2F1999+0%3A0%3A0%22%7D
&ctl00%24cphContent%24cmbServiceCentre=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0
&ctl00_cphContent_cmbServiceCentre_ClientState=
&ctl00%24cphContent%24cmbPostCode=102017
&ctl00_cphContent_cmbPostCode_ClientState=
&ctl00%24cphContent%24cmbAddress3=%D0%A0%D0%B0%D0%B9%D0%BE%D0%BD
&ctl00_cphContent_cmbAddress3_ClientState=
&ctl00%24cphContent%24cmbCity=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0
&ctl00_cphContent_cmbCity_ClientState=
&ctl00%24cphContent%24cmbAddress1=%D0%B3%D1%80%D0%B0%D1%87%D1%91%D0%B2%D0%B0
&ctl00_cphContent_cmbAddress1_ClientState=
&ctl00%24cphContent%24txtAddress2=837
&ctl00%24cphContent%24txtMobile=78473841646
&ctl00%24cphContent%24txtSponsorName=+%D0%92%D1%8F%D1%87%D0%B5%D1%81%D0%BB%D0%B0%D0%B2+%D0%90%D0%BD%D0%B0%D0%BD%D1%8C%D0%B5%D0%B2%D0%B8%D1%87+%D0%A1%D0%B5%D1%80%D0%BE%D0%B2
&ctl00%24cphContent%24chkAgreement=on
&ctl00%24cphContent%24chkAgreement2=on
&ctl00%24cphContent%24btnNext=REGISTER

truss

strace

tusc -. trace UNIX system calls

Found after 5 seconds of heavy-duty Google use. "strace" and "truss" are tools used almost daily, "tusc" was news to me as i do not work on HP-Ux.

Google can be found at "www.google.com" with your favourite web browser.

Glad to be of help.

bakunin

i know dude, thanks
but HOW they can help me here?

They are very educational, and you can see exactly where it goes off the rails: where it gets the host, what host it is looking up, where it looks.

firebug in firefox shows me all this

firebug tells you what firefox is willing to tell you. These strace tools work at a deeper level.

hmm
i never used it for that
so what i should do then?