post

 

   
    NSURL *url = [NSURL URLWithString:@"https://www.baidu.com"];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

    request.HTTPMethod = @"POST";

  // 请求参数 NSString *bodyStr = [NSString stringWithFormat:@"username=%@&password=%@", username, password]; request.HTTPBody = [bodyStr dataUsingEncoding:NSUTF8StringEncoding]; NSData *data =[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSError *error = nil;

    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];

    NSLog(@"---------------%@", json);

posted on 2015-07-05 17:18  兰章海晏  阅读(149)  评论(0编辑  收藏  举报

导航