我需要通过 UITextField 从我的应用程序提交值,我希望这个值显示在我发送请求的网站上。我使用 ASIHTTPRequest 向网站发送请求。我试过这样的事情:
NSURL *url = [NSURL URLWithString:@"http://www.project4hire.com/freelance_job_16265.html"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"POST"];
//
[request setPostValue:priceField forKey:@"bid"];
[request setPostValue:dayField forKey:@"days2c"];
[request setPostValue:commentField forKey:@"comment"];
[request setPostValue:@"1" forKey:@"notify"];
[request setPostValue:@"placebid" forKey:@"Place Bid >>"];
[request setPostValue:@"e6fb12104854e6e9" forKey:@"suid"];
[request setPostValue:@"placebid" forKey:@"a"];
[request setPostValue:@"16265" forKey:@"pid"];
[request setDelegate:self];
[request setDidFailSelector:@selector(requestBidFailed:)];
[request setDidFinishSelector:@selector(requestBidFinished:)];
[request startAsynchronous];
}
- (void)requestBidFailed:(ASIHTTPRequest *)request
{
//notify user
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error sending request to the server" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
- (void)requestBidFinished:(ASIHTTPRequest *)request
{
NSLog(@"Status: %d", request.responseStatusCode);
NSLog(@"string: %@",request.responseString);
}
我收到回复 200,但我发送的值未显示在网站上。谁能给我建议?
谢谢