我正在使用AFNetworking
向服务器发送帖子请求,
请求成功,但没有数据发送到服务器。
响应字符串是html表单本身和
表单填入我发送给服务器的值。
以下是代码
NSURL *url = [NSURL URLWithString:@"http://www.example.com"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"", @"__EVENTTARGET",
@"", @"__EVENTARGUMENT",
@"", @"__LASTFOCUS",
self.VIEWSTATE, @"__VIEWSTATE",
self.subject.text, @"ctl00$ContentPlaceHolder1$messagesubject",
self.message.text, @"ctl00$ContentPlaceHolder1$messagetext",
@"yes", @"ctl00$ContentPlaceHolder1$btn_Submit",
nil];
[httpClient postPath:@"/post.aspx" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *responseStr = [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding];
NSLog(@"Request Successful, response '%@'", responseStr);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"[HTTPClient Error]: %@", error.localizedDescription);
}];
任何想法?