Created
September 6, 2009 02:31
-
-
Save ecarnevale/181612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://simple-note.appspot.com/api/login"]]; | |
| [request setHTTPMethod:@"POST"]; | |
| [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-type"]; | |
| NSString *email = @"email@gmail"; | |
| NSString *pwd = @"password"; | |
| NSString *body = [NSString stringWithFormat:@"email=%@&password=%@", | |
| [email stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding], | |
| [pwd stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding] | |
| ]; | |
| NSLog(@"body: %@",body); | |
| [request setHTTPBody:[body dataUsingEncoding:NSASCIIStringEncoding]]; | |
| NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self]; | |
| [request release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment