/ Published in: Objective C

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//prepar request [request setHTTPMethod:@"POST"]; //set headers [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; //create the body [postBody appendData:[[NSString stringWithFormat:@"<xml>"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"<yourcode/>"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"</xml>"] dataUsingEncoding:NSUTF8StringEncoding]]; //post [request setHTTPBody:postBody]; //get response NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error]; NSLog(@"Response Code: %d", [urlResponse statusCode]); if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) { NSLog(@"Response: %@", result); //here you get the response }
Comments
