我正在使用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);
}];
任何想法?