I've already created my HTTPUrlConnection :
String postData = "x=val1&y=val2"; URL url = new URL(strURL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Set-Cookie", sessionCookie); conn.setRequestProperty("Content-Length", "" + Integer.toString(postData.getBytes().length)); // How to add postData as http body? conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); I don't know how to set postData in http body. How to do so? Would I better use HttpPost instead?
Thanks for your help.
NSString *string = @"x=val1&y=val2"; NSData *postData = [string dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:NO]; [request setHTTPBody:postData];