public static String POST(String url, String param) {
OutputStreamWriter out = null;
BufferedReader in = null;
OutputStream os = null;
InputStream is = null;
InputStreamReader isr = null;
String result = "";
try {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setDoOutput(true);
conn.setDoInput(true);
os=conn.getOutputStream();
os.write(param);
is = conn.getInputStream();
isr = new InputStreamReader(is, "utf-8");
in = new BufferedReader(isr);
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
e.printStackTrace();
}
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if(os!=null){
os.close();
}
if(is!=null){
is.close();
}
if(isr!=null){
isr.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}