Forum Discussion

greengiant83's avatar
14 years ago

How to post form data to URL

I have a few variable that I need to post to a remote server and get the response back from. Basically, I want to get the results back a server as if I had hit the submit button in the browser on a simple page like this:

<html>
<body>
<form action="http://www.gaiamtv-qa.gaiam.com/api/s/login" method="post">
MyParameter1: <input name="MyParameter1" value="foo" /><br />
MyParameter2: <input name="MyParameter2" value="bar" /><br />

<input type="submit" />
</form>
</body>
</html>

4 Replies

  • hello
    i want to send username and password in post form
    i not found any right way to do it kindly help me.
    i have username in one variable and password in other variable
    and i have url so how i send request to the server in post form
  • url="http://www.gaiamtv-qa.gaiam.com/api/s/login?MyParameter1=foo&myparameter2=bar"

    or

    url="http://www.gaiamtv-qa.gaiam.com/aip/s/login?myparameter1="+myparameter1+"&myparameter2="+myparameter2

    xfer=createobject("roURLTransfer")
    xfer.seturl(url)
    asyncpostfromstring("")


    Of course you would need to set up a message port and wait loop to handle the async event results, and you would probably want to xfer.urlencode(parameter) before concatenating the variables into the post string.

    - Joel