Hi everyone, I am developing iphone App using JSON framework, I am calling a PHP script to update MySQL database on local server. Using these code:
NSString *jsonString = [sendData JSONRepresentation];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString*post = [NSString stringWithFormat:@"&json=%@", jsonString];
NSData*postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO];
[request setURL:[NSURL URLWithString:@"http://localhost:8888/update.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[request setHTTPBody:postData];
I would like to ask:
What is the PHP script to get data from that request, and how I can decode JSON data to PHP object to update to database? because I am newbie with PHP, sorry about my basic PHP question.
Any help would be appreciated.
Thank