/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if ([aDictionary count] > 0) { initWithURL:[aRequest URL]]; [request setHTTPMethod:@"POST"]; for (int i = 0; i < [allKeys count]; i++) { [postString appendFormat:( (i == 0) ? @"%@=%@" : @"&%@=%@" ), key, value]; } [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; [postString release]; postString = nil; [request release]; request = nil; return YES; } else { return NO; } } // --------------------------------------------- // usage // Send name=Mark&lastname=Smith initWithObjectsAndKeys: @"Mark", @"name", @"Smith", @"lastname", nil]; [self connectionPOST:request withParams:params]; [params release]; params = nil;