HTML Form via POST method

Discussion in 'iOS Programming' started by satyam90, Sep 17, 2009.

  1. satyam90 macrumors regular


    Jul 30, 2007
    Bangalore, India
    I have an assignment before me. The description is as follows:

    There is a HTML form with 2 text fields and a submit button. When user enters data in 2 fields and presses "submit" button, the data will be sent to an ASP page. it process the data and displays true or false. The data is sent via "POST" method.

    Now I have to develop an application in iPhone that will do similar task.
    I tried NSURLConnection, ASIHTTPRequest etc. But couldn't succeed.

    Can some body show me some way to achieve this?
  2. drivefast macrumors regular

    Mar 13, 2008
    send a request to your asp page thru a proxy, and capture the request and the response, to have a real life sample of what you are trying to accomplish. read the iphone sdk documentation, the "URL Loading System" chapter. then use a NSMutableRequest with a POST http method, set the headers to reflect your sample, and then add your request string in the http body also as it is in your sample. it's really that simple.
  3. satyam90 thread starter macrumors regular


    Jul 30, 2007
    Bangalore, India
    Thanks drivefast, I understood the way of doing it. But while implementing, I'm not able to do it. If you have any example or tutorial, can you share it with me please
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Where are you getting stuck? We can help better if you're more specific.
  5. qmank macrumors newbie

    Mar 6, 2011
    i am facing similar problem. I want to provide proxy host and port to url request. How to provide it in NSMutable request?

  6. KnightWRX, Mar 7, 2011
    Last edited: Mar 7, 2011

    KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    Why can't you use a UIWebView and load this html file from a bundle ressource ?

    <!DOCTYPE html>
    <form method="post" action="http://host.tld/url_to_post_to.asp">
     Field 1 : <input type="text" name="field1" />
     Field 2 : <input type="text" name="field2" />
    Just include the proper CSS and it'll look like a iPhone application.

    EDIT: wow, 2009 uh ? Should look before posting.

Share This Page