我想你想通過POST提交NSURLConnection。你將不得不調整此相匹配的形式,但它應該是類似
NSString *reqURL = [NSString stringWithFormat:@"%@/login",SERVER_URL];
NSMutableURLRequest *req = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:reqURL]];
[req setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
NSData *myRequestData = [NSData dataWithBytes:[@"username=whatever&password=whatever" UTF8String] length: [@"username=whatever&password=whatever" length]];
[req setHTTPMethod: @"POST"];
[req setHTTPBody: myRequestData];
NSData *returnData = [NSURLConnection sendSynchronousRequest:req returningResponse: nil error: nil];
NSString *html = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
可能這回答你的問題:http://stackoverflow.com/questions/1005521/iphone-nsdata-nsurl-with-cookie – 2010-05-03 14:13:22