View Full Version : HTML Form via POST method
satyam90
Sep 17, 2009, 02:20 PM
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?
drivefast
Sep 17, 2009, 02:59 PM
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.
satyam90
Sep 17, 2009, 08:54 PM
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
--Satyam.
dejo
Sep 17, 2009, 11:00 PM
But while implementing, I'm not able to do it.
Where are you getting stuck? We can help better if you're more specific.
qmank
Mar 7, 2011, 12:51 AM
Where are you getting stuck? We can help better if you're more specific.
i am facing similar problem. I want to provide proxy host and port to url request. How to provide it in NSMutable request?
thanks.
KnightWRX
Mar 7, 2011, 05:48 AM
Why can't you use a UIWebView and load this html file from a bundle ressource ?
<!DOCTYPE html>
<html>
<head>
<title>form</title>
</head>
<body>
<div>
<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" />
</form>
</div>
</body>
</html>
Just include the proper CSS and it'll look like a iPhone application.
EDIT: wow, 2009 uh ? Should look before posting.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.