I have attempted to post data into server through json. Suppose i have just one field named username into my xib. Now i am posting this data into server. I have written this code NSString *uname=txt_name.text;
NSMutableURLRequest *request =[[NSMutableURLRequest alloc] initWithURL:
[NSURL URLWithString:@"http://mypath/index.php?params=123"]];
[request setHTTPMethod:@"POST"];
// NSString *postString = @"Email=me@test.com";
[request setValue:[NSString
stringWithFormat:@"%d", [uname length]]
forHTTPHeaderField:@"Content-length"];
[request setHTTPBody:[uname
dataUsingEncoding:NSUTF8StringEncoding]];
[[NSURLConnection alloc]
initWithRequest:request delegate:self];
NSLog(@"text",uname);
But i do not know the data is posting or not. I want to post my input data into console of in Xcode but there nothing is showing. What the reason..? Whats wrong is going on..?
See Question&Answers more detail:os