Forum Moderators: phranque

Message Too Old, No Replies

error converting form post

convert to URL

         

lchurch

2:04 pm on Jun 10, 2011 (gmt 0)

10+ Year Member



I have an existing Web service that supports a number of mobile users in another environment. For a number of reasons i need to use that Web service in this new "stuff" I have a test asp page that uses the following code:
<form method="POST" action="http://myaddress.com/HHQuickSync/QuickSync.aspx">
Login Test
<input type="submit" id="cmd" name="cmd" value="LIN"/>
<input type="text" id="user" name="user" value="alis.tejeda"/>
<input type="text" id="pwd" name="pwd" value="BobSpecialPWD"/>
<span id="spanIn" name="spanIn">Login</span>
</

I have tried dozens of variations of this:
myaddress.com/HHQuickSync/QuickSync.aspx?cmd=LIN&user=alis.tejeda&pwd=BobSpecialPWD

I get an error page page back from the server (it always returns a result code). What am I missing?

phranque

9:49 pm on Jun 10, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



have you checked the server error log?
perhaps the script only allows POST requests.

lchurch

11:28 pm on Jun 10, 2011 (gmt 0)

10+ Year Member



the server only allows POST requests, so is there a way to emulate that through a URL or code?

phranque

11:54 pm on Jun 10, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



if you request a url from the address bar of your browser, that is a GET request.

there are other ways of constructing a POST request without submitting a form.
what are you trying to do?

lchurch

3:30 am on Jun 11, 2011 (gmt 0)

10+ Year Member



That's what I thought the issue would be.
I have an environment where I can submit a string with a URL to the net; I need to construct that string so that it includes the parameters of the form (cmd, user, & pwd).
That's what I was trying to do with this string:
myaddress.com/HHQuickSync/QuickSync.aspx?cmd=LIN&user=alis.tejeda&pwd=BobSpecialPWD
but I could never get the syntax right. Is that possible?

phranque

7:04 am on Jun 11, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I have an environment where I can submit a string with a URL to the net

which means exactly what?
can you submit a POST request from a command line tool such as lwp-request or wget or curl?
or construct/submit a POST request from a script?

lchurch

3:00 pm on Jun 11, 2011 (gmt 0)

10+ Year Member



I can construct/submit a POST request from a script, but the format is what's killing me.

phranque

2:03 am on Jun 12, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the url should be something like example.com/HHQuickSync/QuickSync.aspx and the content of the request should look something like cmd=LIN&user=alis.tejeda&pwd=BobSpecialPWD

phranque

10:41 am on Jun 12, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



when constructing the POST request you also need to specify the encoding used for your content, equivalent to the "enctype" attribute of the "form" element.

http://www.w3.org/TR/html401/interact/forms.html#adef-enctype
This attribute specifies the content type used to submit the form to the server (when the value of method is "post"). The default value for this attribute is "application/x-www-form-urlencoded". The value "multipart/form-data" should be used in combination with the INPUT element, type="file".

http://www.w3.org/TR/html401/interact/forms.html#form-content-type