开发者

How to post data through ASIHTTPRequest in iphone

How to post form field data (name, email,phonenumber,score) through ASI开发者_如何学GoHTTPRequest. I am using json webservices.


Try this , assign variable in your header class

ASIFormDataRequest *requestASI;

in your .m file

 -(void)startASIRequest {

NSString *strUrl = [NSString stringWithFormat:@"http://your url"];

NSURL *url = [NSURL URLWithString:strUrl];

[self setRequestASI:[ASIFormDataRequest requestWithURL:url]];

[requestASI setDelegate:self];

[requestASI setRequestMethod:@"POST"];

[requestASI setPostValue:@"1" forKey:@"name"];

 [requestASI setDidFailSelector:@selector(uploadFailed:)];

[requestASI setDidFinishSelector:@selector(uploadFinished:)];

[requestASI startAsynchronous];


   - (void)uploadFinished:(ASIHTTPRequest *)theRequest {

NSLog(@"registerFinished %@",[theRequest responseString]);

  }

  - (void)uploadFailed:(ASIHTTPRequest *)theRequest {

NSLog(@"registerFailed %@", [theRequest error]);

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜