Never mind that was easy, just added this function to mnet:
String mnetHttpPost( String urlStr, String postStr, int timeoutConnection, int timeoutSocket )
{
NSString *urlString = urlStr.ToNSString();
NSString *postString = postStr.ToNSString();
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
float timeout = (float)timeoutConnection / 1000.0f;
[request setTimeoutInterval:timeout];
[request setHTTPMethod: @"POST"];
[request setValue:[NSString stringWithFormat:@"%d", [postString length]]forHTTPHeaderField:@"Content-length"];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSData *response = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil];
NSString *stringResponse = [[NSString alloc] initWithData: response encoding: NSUTF8StringEncoding];
return String( stringResponse );
}
|