Skip to content

Instantly share code, notes, and snippets.

@ecarnevale
Created September 6, 2009 02:31
Show Gist options
  • Select an option

  • Save ecarnevale/181612 to your computer and use it in GitHub Desktop.

Select an option

Save ecarnevale/181612 to your computer and use it in GitHub Desktop.
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