Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 01-31-2010, 01:27 PM   #2 (permalink)
harrytheshark
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

When your web browser submits a form, what it's doing is posting the values for the fields in this format:

"name1=value1&name2=value2", so in this case "user_id=whatever&password=whatever".

You'll need to gather where the form is submitted (it's in the HTML source code, usually called the "action" or something like that), then you need to post the data yourself.

A very simple example of this would be something like:
Code:
NSString * postString = [NSString stringWithFormat: @"user_id=%@&password=%@",theUserName,thePassword];
NSData *myRequestData = [NSData dataWithBytes:[postString UTF8String] length:[postString length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString: @"http://www.theaddress.com"]]; 
[request setHTTPMethod:@"POST"];
[request setHTTPBody:myRequestData];
NSData * response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
[request release];
Hope that helps!
harrytheshark is offline   Reply With Quote
 

» Advertisements
» Online Users: 320
18 members and 302 guests
ADY, BdR, BrianSlick, Diegan, djohnson, F_Bryant, Herbie, ilmman, Joseph Nardone, laurielaptop, M@realobjects, Profile, rob.mccarthy, rodgo, Sunny46, TheWebWizz, VikMyr, yomo710
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,702
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.