Whenever I set a body on a mutable request with the method set to anything other than POST, the body is not included in the request and I get a kCFErrorDomainCFNetwork error
here it is
+(NSString*)simpleCurl:(NSString*)urlStr withBody:(NSString*)post{
// NSLog(urlStr);
NSURL *url = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
// NSLog([url description]);
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
[req setHTTPMethod:@"POST"];
[req setValue:@"close" forHTTPHeaderField:@"Connection"];
[req setValue:@"utf-8;q=0.7,*;q=0.7" forHTTPHeaderField:@"Accept-Charset"];
[req setValue:@"gzip,deflate" forHTTPHeaderField:@"Accept-Encoding"];
[req setValue:@"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" forHTTPHeaderField:@"User-Agent"];
[req setValue:@"Application/Json, text/html, application/xhtml+xml, */*" forHTTPHeaderField:@"Accept"];
[req setHTTPMethod:@"POST"];// or PUT
NSString *postString = post;
[req setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSData *res = [NSURLConnection sendSynchronousRequest:req returningResponse:NULL error:NULL];
NSString* html=[[NSString alloc] initWithData:res encoding:NSUTF8StringEncoding];
return html;
}