emilyk
emilyk

Reputation: 713

Secure transfer of password from iPhone app to web server

This is probably asked somewhere else, but I sure can't find it...

I am building an iPhone app that will take the username and password from UITextFields and use them to login.

My php script takes a $_REQUEST["user"] and $_REQUEST["password"] to login. I got this working:

- (IBAction)submit:(id)sender {
    NSString *url=[NSString stringWithFormat:@"https://localhost:8443/index.php?at=main&pre=login&pre=login&user=%@&password=%@", _usernameentered, _passwordentered];
    NSLog(@"%@",url);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
};

However, the password is still sent in plain text. I need to send it as a POST variable, but I am not sure how to do that. I feel like there should be a couple lines of code to tell what the POST variables are, but I can't really find anything on the internet. Maybe I am searching with the wrong terms.

Also, I am developing for ios5, so I don't want to us ASIHTTPrequest.

Any help would be appreciated. Thanks!

Upvotes: 1

Views: 270

Answers (1)

Michael Frederick
Michael Frederick

Reputation: 16714

You want to use NSURLConnection. Here is a guide. It is good that you are using HTTPS.

Upvotes: 3

Related Questions