I have a JSON string in an Objective-C app, and I want to send it to a PHP script on a server.
What PHP code should I use to receive and parse this data?
- (IBAction)send:(id)sender{
NSString *jsonString = [selectedPerson.jsonDictionary JSONRepresentation];
NSLog(@"ESE ES EL JSON %@", jsonString);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init ];
NSString*post = [NSString stringWithFormat:@"&json=%@", jsonStri ng];
NSData*postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO];
NSLog(@"ESTO ES DATA %@", postData);
[request setURL:[NSURL URLWithSt ring:@"http://www.mydomine.com/recive.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content- type"];
[request setHTTPBody:postData];
}