public static String getResponseFromHttpUrl(URL url, JSONObject postjson) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
try {
con.setRequestMethod("POST");
con.setDoOutput(true);
con.setConnectTimeout(5000);
con.setReadTimeout(4*60*1000);
OutputStream os = con.getOutputStream();
byte[] input = postjson.toString().getBytes("utf-8");
os.write(input, 0, input.length);
StringBuilder stringBuilder = new StringBuilder();
InputStream instream=con.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(instream, Charset.forName("windows-1253")));
String inputLine;
while ((inputLine = in.readLine()) != null) {
stringBuilder.append(inputLine);
}
in.close();
String returnme=stringBuilder.toString();
return returnme;
}catch (Exception ex){
int aa=1;
return null;
} finally {
con.disconnect();
}
}