Skip to content

Instantly share code, notes, and snippets.

@pita5
Created October 17, 2012 12:02
Show Gist options
  • Select an option

  • Save pita5/3905179 to your computer and use it in GitHub Desktop.

Select an option

Save pita5/3905179 to your computer and use it in GitHub Desktop.
for (int i = 0; i < 100; i++)
{
NSMutableURLRequest* postRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://mastercard.cmdapp.com/Services/Html.asmx/GetHtml"]];
[postRequest setHTTPMethod:@"POST"];
[postRequest setHTTPBody:[@"{ moduleID : 1}" dataUsingEncoding:NSUTF8StringEncoding]];
[postRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
__autoreleasing NSHTTPURLResponse* response = nil;
NSData* postData = [NSURLConnection sendSynchronousRequest:postRequest
returningResponse:&response
error:nil];
NSString* postStr = [[NSString alloc] initWithData:postData encoding:NSUTF8StringEncoding];
NSLog(@"Post data got %d back \n %@", postStr.length, postStr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment