title: POST request in Objective-C
body: <p>Searching the web for some method to send POST requests in Objective-C, I came up with some solutions.</p>
  
  <p>That's what I've got:</p>
  
  <pre><code>responseData = [NSMutableData new];
  NSURL *url = [NSURL URLWithString:@"http://mydomain.com/page.php?"];
  NSString *myParameters = [[NSString alloc] initWithFormat:@"str=hello"];
  
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
  
  [request setHTTPMethod:@"POST"];
  [request setHTTPBody:[myParameters dataUsingEncoding:NSUTF8StringEncoding]];
  </code></pre>
  
  <p>The response I receive is an error, because the POST variable "str" hasn't been set.</p>
  
  <p>What am I doing wrong?</p>