i use this method to send post request to my server and save data to sql database but I've a problem i miss some character when data saved to database for example i have this string "example post ++ request ++" when received to database string changes "example post request" by missing + Plus signs here is my code
xcode
NSString *STR = @"mystring=example post ++ request ++";
NSData *PostData = [STR dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://MySiteUrl.com/example.php"]];
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:PostData];
[request setHTTPMethod:@"POST"];
NSError *error = nil;
NSURLResponse *response = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
php code
$STR = $_POST['mystring'];
header ('Content-Type: text/html; charset=UTF-8');
$con = mysql_connect("localhost","xxxxxx","xxxx");
mysql_select_db("xxxxxxx", $con);
mysql_query("SET NAMES utf8");
$STR = trim($STR);
mysql_query("INSERT INTO `xxxxxxx`.`table` (`id`, `mystring`) VALUES (NULL, '$STR');");