I am doing this:
@Override
protected Void doInBackground(String... strings) {
try {
String query = "username=" + strings[0] + "&duration=" + strings[1] + "&distance=" + strings[2];
URL url = new URL(ScoresActivity.URL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
Writer writer = new OutputStreamWriter(conn.getOutputStream());
writer.write(query);
writer.flush();
writer.close();
/*conn.addRequestProperty("username", strings[0]);
conn.addRequestProperty("duration", strings[1]);
conn.addRequestProperty("distance", strings[2]);*/
Log.v(TAG, strings[0] + " - " + strings[1] + " - " + strings[2]);
//conn.connect();
} catch(Exception e) {
Log.e(TAG, "exception", e);
}
return null;
}
but the request just doesn't take effect on the server... on the server I should see the data sent, but I don't see them
I also tried this:
curl -XPOST --data "username=duri&duration=600&distance=555" http://someurl.com/
and it works... what could be the problem?