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];
精彩评论