Forked from fawkeswei/AFNetworking_post_json.m
Last active
December 20, 2015 16:38
-
-
Save syxc/6162358 to your computer and use it in GitHub Desktop.
This file contains 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
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: | |
height, @"user[height]", | |
weight, @"user[weight]", | |
nil]; | |
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL: | |
[NSURL URLWithString:@"http://localhost:8080/"]]; | |
[client postPath:@"/mypage.php" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSString *text = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; | |
NSLog(@"Response: %@", text); | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"%@", [error localizedDescription]); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment