title: HTTP Post method php and ios
body: <p>i'm facing a big problem, </p>
  
  <p>I want to send data to my server, my data is a string. </p>
  
  <p>I do not want to use Get method because the string might be very long, so i want to use POST method but everything goes, wrong, if someone can help me he'll be my hero :) </p>
  
  <p>Here is my php code : </p>
  
  <pre><code>&lt;?php include("config.inc.php");
  if (isset($_POST['contentInterro']) &amp;&amp; $_POST['contentInterro'] !="" ) {
  //$id_user = $_POST['contentInterro'];
  //$db-&gt;sql_query("INSERT INTO interrogations VALUES(DEFAULT, '$id_user')");
  echo "succes";
  }else{
  echo "This is an error";
  }
  
  ?&gt;
  </code></pre>
  
  <p>Here is my app code : </p>
  
  <pre><code> NSData *postData = [stringToPost2 dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
  
      NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
  
  
      NSMutableURLRequest *requestPost = [[NSMutableURLRequest alloc] init];
  
      NSURL *urlPost = [NSURL URLWithString:@"http://buzznapps.fr/FDF/postInterrogation.php"];
  
      [requestPost setURL:urlPost];
      [requestPost setHTTPMethod:@"POST"];
      [requestPost setValue:@"lol" forHTTPHeaderField:@"contentInterro"]; 
  
  
  
      NSError *errorURL;
      NSURLResponse *response;
      NSData *urlData = [NSURLConnection sendSynchronousRequest:requestPost returningResponse:&amp;response error:&amp;errorURL];
  
      NSString *str = [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
  
      NSLog(@"Str = %@",str); 
  </code></pre>
  
  <p>I always get an error, and i've search the web i do not know how to get this data ! 
  Thanks for any help. </p>