List of utility methods to do URL Post
boolean | postToUrl(String page) post To Url URL url; URLConnection urlConn; DataOutputStream printout; DataInputStream input; try { url = new URL(page); urlConn = url.openConnection(); urlConn.setDoInput(true); ... |
String | postUrl(URL url, String data) post Url OutputStreamWriter wr = null; BufferedReader rd = null; try { URLConnection conn = url.openConnection(); conn.setDoOutput(true); wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); ... |
void | writePostRequest(URLConnection connection, String postRequestBody, String contentType) write Post Request connection.setDoOutput(true); if (contentType != null) { connection.setRequestProperty("Content-Type", contentType); try (DataOutputStream out = new DataOutputStream(connection.getOutputStream())) { out.writeBytes(postRequestBody); |
String | xmlPost(String urlStr, String xmlInfo) xml Post try { URL url = new URL(urlStr); URLConnection con = url.openConnection(); con.setDoOutput(true); con.setRequestProperty("Pragma:", "no-cache"); con.setRequestProperty("Cache-Control", "no-cache"); con.setRequestProperty("Content-Type", "text/xml"); OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream()); ... |
URLConnection | writeString(URLConnection connection, String string) write String writeString(connection.getOutputStream(), string);
return connection;
|