I am trying to post data using HTTP post but I can't see the data on the other end (server).
When I'm running the program I'm getting a response code 200 (success) but when I cross check no data is found on the other end
private void sendPost() throws Exception {
    String url = "https://example.com/post/index.php";
    URL obj = new URL(url);
    HttpsURLConnection con = (HttpsURLConnection)obj.openConnection();
    //add reuqest header
    con.setRequestMethod("POST");
    con.setRequestProperty("User-Agent", USER_AGENT);
    con.setRequestProperty("charset", "utf-8");
    String urlParameters = "username=userpv&password=pvpwd&admin_username=&admin_password=&action=add&requisition_number=403555&return_url=&error_url=www.some.com&error_format=1";
    // urlParameters string is very long
    con.setDoOutput(true);
    DataOutputStream wr = new DataOutputStream(con.getOutputStream());
    wr.writeBytes(urlParameters);
    wr.flush();
    wr.close();
    int responseCode = con.getResponseCode();
    System.out.println("\nSending 'POST' request to URL : " + url);
    System.out.println("Post parameters : " + urlParameters);
    System.out.println("Response Code : " + responseCode);
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        System.out.println(inputLine);
    }
    in.close();
    //print result
    //System.out.println(response.toString());
}
Can anyone tell me what's wrong with my code?
 
     
    