开发者

iphone textview contents to url?

How can i have a uitextview value be taken and send to a predefined url using o开发者_开发技巧bj-c only without any html /php.


Take a look at NSURL. Use the text value of the UITextView as a parameter.

e.g.

NSURL *webURL = [NSURL URLWithString:MY_TEXTVIEW.text];
NSURLRequest *req = [NSURLRequest requestWithURL:webURL];


NSString *methodString = @"method";
NSString *parameterString = [NSString stringWithFormat:@"value=%@", textField.text];
NSString *apiRoot = @"http://www.domain.com";   
NSURL *apiUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@?%@", apiRoot,methodString,parameterString]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:apiUrl];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜