I am trying to write a program such that I can use $_POST['id'] to specify an ID and to write the rest of the binary data into "php://input". My current Java code looks like:
HttpURLConnection connection = (HttpURLConnection) new URL("https://example.com/write?id="+id).openConnection();
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.addRequestProperty("Content-Type", "application/bin");
DataOutputStream os = new DataOutputStream(connection.getOutputStream());
os.flush();
gameLevel.writeCompressedBinary(os);
os.close();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String result = reader.readLine();
reader.close();
return result;
Problem is, $_POST['id'] does not exist when processed by the PHP file, but $_REQUEST['id'] does. I do not want 'id' to be visible over a GET request. What would be the best way to accomplish what I'm trying to do?
I can't use any 3rd party libraries to accomplish this.