Created
March 2, 2011 19:56
-
-
Save dbrajkovic/851609 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
+(void)updateAccount:(CPDictionary)accountParams delegate:(id)delegate | |
{ | |
var urlString = [CPString stringWithFormat:@"http://api.webservice.com/account/update.json"]; | |
var request = [self requestWithURLString:urlString]; | |
var name = [accountParams valueForKey:@"name"]; | |
var username = [accountParams valueForKey:@"username"]; | |
var email = [accountParams valueForKey:@"email"]; | |
var postBody = [CPString stringWithFormat:@"name=%@&username=%@&email=%@", name, username, email]; | |
[request setValue:[postBody length] forHTTPHeaderField:@"Content-Length"]; | |
[request setHTTPMethod:@"POST"]; | |
[request setValue:"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; | |
[request setHTTPBody:postBody]; | |
[CPURLConnection connectionWithRequest:request delegate:delegate]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment