Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
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?
 

drivefast

macrumors regular
Mar 13, 2008
128
0
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

macrumors regular
Original poster
Jul 30, 2007
242
0
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
--Satyam.
 

qmank

macrumors newbie
Mar 6, 2011
1
0
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

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

Code:
<!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.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.