We do not know your question, but my answer is short and simple. To do this, you should use the excellent open source library, which is: AFNetworking , and run the query as follows:
_httpClient = [[AFHTTPClient alloc] initWithBaseURL:[[NSURL alloc] initWithString:@"http://sajalaya.com"]]; [_httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]]; NSData *jsonData2 = [NSJSONSerialization dataWithJSONObject:comment options:NSJSONWritingPrettyPrinted error:nil]; NSString *new = [[NSString alloc] initWithData:jsonData2 encoding:NSUTF8StringEncoding]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: new, @"comment", @4, @"total, nil]; NSMutableURLRequest *request = [self.httpClient requestWithMethod:@"POST" path:@"/taskblazer/staffend/form/iphonearraytest.php" parameters:params]; request.timeoutInterval = 8; AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { // success } failure:^(AFHTTPRequestOperation *operation, NSError *error) { // failure }];
source share