{
"response":{
"firstname":"Fir",
"frlogs":[
{
"action":"test3",
"dateverified":"2019-07-04 10:55",
"membershipappid":"0000000000",
"isverified":"true",
"lastverified":"2019-07-04 10:55",
"transactiondate":"2019-07-04"
}
]
}
}
public void sendPost() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
URL url = new URL("my url");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
conn.setRequestProperty("Accept","application/json");
conn.setDoOutput(true);
conn.setDoInput(true);
JSONObject obj = new JSONObject();
JSONArray array = new JSONArray();
obj.put("action", "Success");
obj.put("dateverified", currentDateandTime);
obj.put("membershipappid", AppData.usrID);
obj.put("isverified", "True");
obj.put("lastverified", currentDateandTime);
obj.put("transactiondate", currentDateandTime);
array.put(obj);
DataOutputStream os = new DataOutputStream(conn.getOutputStream());
os.writeBytes(obj.toString());
os.flush();
os.close();
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
});
thread.start();
}